Pinned posts now work for visitors in the intended way
This commit is contained in:
@@ -801,10 +801,12 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
|
||||
/**
|
||||
* Fetch all comments from a query. Additionally set the newest resharer as thread owner.
|
||||
*
|
||||
* @param $thread_items Database statement with thread posts
|
||||
* @param array $thread_items Database statement with thread posts
|
||||
* @param boolean $pinned Is the item pinned?
|
||||
*
|
||||
* @return array items with parents and comments
|
||||
*/
|
||||
function conversation_fetch_comments($thread_items) {
|
||||
function conversation_fetch_comments($thread_items, $pinned) {
|
||||
$comments = [];
|
||||
$parentlines = [];
|
||||
$lineno = 0;
|
||||
@@ -822,6 +824,10 @@ function conversation_fetch_comments($thread_items) {
|
||||
$parentlines[] = $lineno;
|
||||
}
|
||||
|
||||
if ($row['gravity'] == GRAVITY_PARENT) {
|
||||
$row['pinned'] = $pinned;
|
||||
}
|
||||
|
||||
$comments[] = $row;
|
||||
$lineno++;
|
||||
}
|
||||
@@ -872,7 +878,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
|
||||
|
||||
$thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params);
|
||||
|
||||
$comments = conversation_fetch_comments($thread_items);
|
||||
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false);
|
||||
|
||||
if (count($comments) != 0) {
|
||||
$items = array_merge($items, $comments);
|
||||
|
||||
Reference in New Issue
Block a user