Display a symbol when a post had been reshared

This commit is contained in:
Michael 2020-08-23 13:26:23 +00:00
parent b052896c64
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;
}

View File

@ -409,7 +409,9 @@ class Post
}
$direction = [];
if (DI::config()->get('debug', 'show_direction')) {
if (!empty($item['direction'])) {
$direction = $item['direction'];
} elseif (DI::config()->get('debug', 'show_direction')) {
$conversation = DBA::selectFirst('conversation', ['direction'], ['item-uri' => $item['uri']]);
if (!empty($conversation['direction']) && in_array($conversation['direction'], [1, 2])) {
$title = [1 => DI::l10n()->t('Pushed'), 2 => DI::l10n()->t('Pulled')];

View File

@ -5,6 +5,8 @@
<i class="fa fa-inbox" aria-hidden="true" title="{{$direction.title}}"></i>
{{elseif $direction.direction == 2}}
<i class="fa fa-download" aria-hidden="true" title="{{$direction.title}}"></i>
{{elseif $direction.direction == 3}}
<i class="fa fa-share-alt" aria-hidden="true" title="{{$direction.title}}"></i>
{{/if}}
</span>
{{/if}}