diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-26 18:29:24 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-26 18:29:24 -0800 |
commit | 0e91810ed6764fbbee54e918711bfb45a1d9fd72 (patch) | |
tree | f6c3d995e438057161ecdd7f0afd479df5a751e6 /Zotlabs/Module/Subthread.php | |
parent | e1fdac32782de11e443c7398ff3fb9870fa9b2d9 (diff) | |
download | volse-hubzilla-0e91810ed6764fbbee54e918711bfb45a1d9fd72.tar.gz volse-hubzilla-0e91810ed6764fbbee54e918711bfb45a1d9fd72.tar.bz2 volse-hubzilla-0e91810ed6764fbbee54e918711bfb45a1d9fd72.zip |
pubstream comments and a few other bugfixes that were discovered along the way
Diffstat (limited to 'Zotlabs/Module/Subthread.php')
-rw-r--r-- | Zotlabs/Module/Subthread.php | 32 |
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']) |