diff options
-rw-r--r-- | Zotlabs/Module/Channel.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 2 | ||||
-rw-r--r-- | include/items.php | 12 |
3 files changed, 9 insertions, 7 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 39eee37bd..2619911b3 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -416,7 +416,7 @@ class Channel extends Controller { if ($r) { $parents_str = ids_to_querystr($r, 'item_id'); - $r = items_by_parent_ids($parents_str, blog_mode: $blog_mode); + $r = items_by_parent_ids($parents_str, sql_extra: $sql_extra, blog_mode: $blog_mode); xchan_query($r); $items = fetch_post_tags($r, true); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index c11da2e85..baa352e7f 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -291,7 +291,7 @@ class Display extends Controller { $parents_str = ids_to_querystr($r,'item_id'); if($parents_str) { $thr_parents_str = stringify_array(get_recursive_thr_parents($target_item), true); - $items = items_by_parent_ids($parents_str, $thr_parents_str); + $items = items_by_parent_ids($parents_str, $thr_parents_str, $sql_extra); xchan_query($items); $items = fetch_post_tags($items,true); diff --git a/include/items.php b/include/items.php index f25a564a5..d71fccf80 100644 --- a/include/items.php +++ b/include/items.php @@ -5446,7 +5446,7 @@ function item_by_item_id(int $id): array * @param bool $blog_mode (optional) - if set to yes only the parent items will be returned */ -function items_by_parent_ids(string $ids, string $thr_parents = '', bool $blog_mode = false): array +function items_by_parent_ids(string $ids, string $thr_parents = '', string $sql_extra = '', bool $blog_mode = false): array { $item_normal = item_normal(); $item_normal_c = item_normal(prefix: 'c'); @@ -5479,6 +5479,7 @@ function items_by_parent_ids(string $ids, string $thr_parents = '', bool $blog_m AND c.item_thread_top = 0 AND c.thr_parent = item.mid $item_normal_c + $sql_extra $thr_parent_uuid_sql_join WHERE $blog_mode_sql in (%s) AND ( @@ -5487,6 +5488,7 @@ function items_by_parent_ids(string $ids, string $thr_parents = '', bool $blog_m ) $thr_parent_sql $item_normal + $sql_extra GROUP BY item.id", dbesc($ids) ); @@ -5509,13 +5511,13 @@ function items_by_thr_parent(string $mid, int $parent): array intval($parent) ); - $owner_uid = $parent_item[0]['uid']; + $owner_uid = intval($parent_item[0]['uid']); $item_normal = item_normal($owner_uid); $item_normal_c = item_normal($owner_uid, 'c'); $activity_sql = item_activity_sql('c'); - if (local_channel()) { + if (local_channel() === $owner_uid) { $ret = q( "SELECT item.*, $activity_sql @@ -5581,10 +5583,10 @@ function item_activity_xchans(string $mid, int $parent, string $verb): array intval($parent) ); - $owner_uid = $parent_item[0]['uid']; + $owner_uid = intval($parent_item[0]['uid']); $item_normal = item_normal($owner_uid); - if (local_channel()) { + if (local_channel() === $owner_uid) { $ret = q("SELECT item.id, item.item_blocked, xchan.xchan_hash, xchan.xchan_name as name, xchan.xchan_url as url, xchan.xchan_photo_s as photo FROM item LEFT JOIN xchan ON item.author_xchan = xchan.xchan_hash WHERE item.uid = %d |