]> git.mxchange.org Git - friendica.git/commitdiff
Display a symbol when a post had been reshared
authorMichael <heluecht@pirati.ca>
Sun, 23 Aug 2020 13:26:23 +0000 (13:26 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 23 Aug 2020 13:26:23 +0000 (13:26 +0000)
include/conversation.php
src/Object/Post.php
view/theme/frio/templates/sub/direction.tpl

index 1c9c37d24a7c872d9a0ca2f06c477c55d505f05e..01139a2cb9d928400ec9e8ca48638a0054fff9fd 100644 (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;
 }
 
index a1b3941aeff3a9b60ff54f6c2406a8e444a06d5c..0f2a0c65182e9adb445ac40b34ebf4d0e5857ddd 100644 (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')];
index be34a1edc9a3fc129f64fb317676e866cc9c2231..462f540b358c0dc49cd7d44921e3acc62549154e 100644 (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}}