1
0
Fork 0

Display a symbol when a post had been reshared

This commit is contained in:
Michael 2020-08-23 13:26:23 +00:00
commit 0e4d3fe9e5
3 changed files with 24 additions and 1 deletions

View file

@ -708,17 +708,36 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
*/
function conversation_fetch_comments($thread_items, $pinned) {
$comments = [];
$parentlines = [];
$lineno = 0;
$direction = [];
while ($row = Item::fetch($thread_items)) {
if (($row['verb'] == Activity::ANNOUNCE) && ($row['thr-parent'] == $row['parent-uri'])
&& Contact::isSharing($row['author-id'], $row['uid'])) {
$direction = ['direction' => 3, 'title' => DI::l10n()->t('Reshared')];
}
if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id'])
&& !Contact::isSharing($row['author-id'], $row['uid'])) {
$parentlines[] = $lineno;
}
if ($row['gravity'] == GRAVITY_PARENT) {
$row['pinned'] = $pinned;
}
$comments[] = $row;
$lineno++;
}
DBA::close($thread_items);
if (!empty($direction)) {
foreach ($parentlines as $line) {
$comments[$line]['direction'] = $direction;
}
}
return $comments;
}