aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Subthread.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-01-16 11:45:01 +0100
committerGitHub <noreply@github.com>2018-01-16 11:45:01 +0100
commite81949bb095448881ce83605a50454d0c3c40782 (patch)
treebd15059a020152b5dc59c265e22a27251efe0de4 /Zotlabs/Module/Subthread.php
parentb4f8f4df7bc5cc8a74240506cd536224cb31e114 (diff)
parent9aadcb0bd40a8f773dc164f7dadc8c238fff9954 (diff)
downloadvolse-hubzilla-e81949bb095448881ce83605a50454d0c3c40782.tar.gz
volse-hubzilla-e81949bb095448881ce83605a50454d0c3c40782.tar.bz2
volse-hubzilla-e81949bb095448881ce83605a50454d0c3c40782.zip
Merge pull request #7 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs/Module/Subthread.php')
-rw-r--r--Zotlabs/Module/Subthread.php32
1 files changed, 28 insertions, 4 deletions
diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php
index dae8bf020..1a9caff6c 100644
--- a/Zotlabs/Module/Subthread.php
+++ b/Zotlabs/Module/Subthread.php
@@ -11,10 +11,13 @@ class Subthread extends \Zotlabs\Web\Controller {
function get() {
- if((! local_channel()) && (! remote_channel())) {
+ if(! local_channel()) {
return;
}
+ $sys = get_sys_channel();
+ $channel = \App::get_channel();
+
$item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0);
if(argv(1) === 'sub')
@@ -23,10 +26,31 @@ class Subthread extends \Zotlabs\Web\Controller {
$activity = ACTIVITY_UNFOLLOW;
- $r = q("SELECT parent FROM item WHERE id = '%s'",
- dbesc($item_id)
+ $i = q("select * from item where id = %d and uid = %d",
+ intval($item_id),
+ intval(local_channel())
);
-
+
+ if(! $i) {
+ $i = q("select * from item where id = %d and uid = %d",
+ intval($postid),
+ intval($sys['channel_id'])
+ );
+
+ if($i) {
+ $i = [ copy_of_pubitem($channel, $i[0]['mid']) ];
+ $item_id = (($i) ? $i[0]['id'] : 0);
+ }
+ }
+
+ if(! $i) {
+ return;
+ }
+
+ $r = q("SELECT parent FROM item WHERE id = %d",
+ intval($item_id)
+ );
+
if($r) {
$r = q("select * from item where id = parent and id = %d limit 1",
dbesc($r[0]['parent'])