From 206caaf51a1608c59de130bad9d75e7b3d98b2ce Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 9 Sep 2020 04:49:42 +0000 Subject: [PATCH] Reshared data now is a link --- include/conversation.php | 19 +++++++++++++------ src/Object/Post.php | 8 +------- view/templates/wall_thread.tpl | 3 +++ view/theme/frio/templates/wall_thread.tpl | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 93c7fb406..99f3d76b0 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -727,7 +727,12 @@ function conversation_fetch_comments($thread_items, $pinned) { && ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received) && Contact::isSharing($row['author-id'], $row['uid'])) { $direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])]; - $actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']]; + + $author = ['uid' => 0, 'id' => $row['author-id'], + 'network' => $row['author-network'], 'url' => $row['author-link']]; + $url = '' . htmlentities($row['author-name']) . ''; + + $actor = ['url' => $url, 'link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']]; $received = $row['received']; } @@ -758,11 +763,13 @@ function conversation_fetch_comments($thread_items, $pinned) { if (!empty($direction)) { foreach ($parentlines as $line) { $comments[$line]['direction'] = $direction; - $comments[$line]['reshared'] = DI::l10n()->t('%s reshared this.', $actor['name']); - if (!empty($actor) && DI::pConfig()->get(local_user(), 'system', 'display_resharer') ) { - $comments[$line]['owner-link'] = $actor['link']; - $comments[$line]['owner-avatar'] = $actor['avatar']; - $comments[$line]['owner-name'] = $actor['name']; + if (!empty($actor)) { + $comments[$line]['reshared'] = DI::l10n()->t('%s reshared this.', $actor['url']); + if (DI::pConfig()->get(local_user(), 'system', 'display_resharer') ) { + $comments[$line]['owner-link'] = $actor['link']; + $comments[$line]['owner-avatar'] = $actor['avatar']; + $comments[$line]['owner-name'] = $actor['name']; + } } } } diff --git a/src/Object/Post.php b/src/Object/Post.php index 788fdedde..071652b5e 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -419,12 +419,6 @@ class Post } } - if (!empty($item['reshared'])) { - $reshared = $item['reshared']; - } else { - $reshared = ''; - } - $tmp_item = [ 'template' => $this->getTemplate(), 'type' => implode("", array_slice(explode("/", $item['verb']), -1)), @@ -503,7 +497,7 @@ class Post 'uriid' => $item['uri-id'], 'return' => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '', 'direction' => $direction, - 'reshared' => $reshared, + 'reshared' => $item['reshared'] ?? '', 'delivery' => [ 'queue_count' => $item['delivery_queue_count'], 'queue_done' => $item['delivery_queue_done'] + $item['delivery_queue_failed'], /// @todo Possibly display it separately in the future diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index c2b436959..202eb2b61 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -20,6 +20,9 @@
+ {{if $item.reshared}} +
{{$item.reshared nofilter}}
+ {{/if}}
{{if $item.owner_url}}
diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index a4f980827..317217b47 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -82,7 +82,7 @@ as the value of $top_child_total (this is done at the end of this file) {{/if}}
{{if $item.reshared}} -
{{$item.responses.announce.output nofilter}}
+
{{$item.reshared nofilter}}
{{/if}} {{* The avatar picture and the photo-menu *}}