From d3e19bc880e36eef08265088bcfb2c5a5939c527 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Oct 2020 08:49:47 +0000 Subject: [PATCH] Support for real reshares --- include/conversation.php | 7 ++++--- src/Object/Post.php | 13 ++++++++---- view/templates/wall_thread.tpl | 3 ++- view/theme/frio/templates/wall_thread.tpl | 20 ++++++++++++++++--- view/theme/quattro/templates/wall_thread.tpl | 3 +++ view/theme/smoothly/templates/wall_thread.tpl | 5 ++++- view/theme/vier/templates/wall_thread.tpl | 4 +++- 7 files changed, 42 insertions(+), 13 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index c2226fa35..a0d1177c3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -562,9 +562,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o ]; $likebuttons = [ - 'like' => null, - 'dislike' => null, - 'share' => null, + 'like' => null, + 'dislike' => null, + 'share' => null, + 'announce' => null, ]; if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { diff --git a/src/Object/Post.php b/src/Object/Post.php index 894b75f93..f3a4aeba1 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -151,9 +151,10 @@ class Post } $sparkle = ''; $buttons = [ - 'like' => null, - 'dislike' => null, - 'share' => null, + 'like' => null, + 'dislike' => null, + 'share' => null, + 'announce' => null, ]; $dropping = false; $pinned = ''; @@ -175,6 +176,7 @@ class Post : false); $shareable = in_array($conv->getProfileOwner(), [0, local_user()]) && $item['private'] != Item::PRIVATE; + $announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN]); $edpost = false; @@ -344,7 +346,10 @@ class Post $buttons['like'] = [DI::l10n()->t("I like this \x28toggle\x29") , DI::l10n()->t("like")]; $buttons['dislike'] = [DI::l10n()->t("I don't like this \x28toggle\x29"), DI::l10n()->t("dislike")]; if ($shareable) { - $buttons['share'] = [DI::l10n()->t('Share this'), DI::l10n()->t('share')]; + $buttons['share'] = [DI::l10n()->t('Share this'), DI::l10n()->t('Share')]; + } + if ($announceable) { + $buttons['announce'] = [DI::l10n()->t('Announce this'), DI::l10n()->t('Announce')]; } } diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index b869b996d..1d1a766c9 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -82,7 +82,8 @@
{{if $item.vote.dislike}}{{/if}} - {{if $item.vote.share}}{{/if}} + {{if $item.vote.announce}}{{/if}} + {{if $item.vote.share}}{{/if}}
{{/if}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 0375dc472..2e7a1fb27 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -311,11 +311,17 @@ as the value of $top_child_total (this is done at the end of this file) {{* Button for sharing the item *}} {{if $item.vote}} - {{if $item.vote.share}} + {{if $item.vote.share OR $item.vote.announce}} {{if $item.vote.like OR $item.vote.dislike OR $item.comment_html}} {{/if}} - + {{/if}} + {{if $item.vote.announce}} + + + {{/if}} + {{if $item.vote.share}} + {{/if}} {{/if}} @@ -434,10 +440,18 @@ as the value of $top_child_total (this is done at the end of this file) {{/if}} + {{* Button for announcing the item *}} + {{if $item.vote.announce}} + + {{/if}} + {{* Button for sharing the item *}} {{if $item.vote.share}}
- +
{{/if}} diff --git a/view/theme/quattro/templates/wall_thread.tpl b/view/theme/quattro/templates/wall_thread.tpl index a97a0cc5e..84f83e06f 100644 --- a/view/theme/quattro/templates/wall_thread.tpl +++ b/view/theme/quattro/templates/wall_thread.tpl @@ -122,6 +122,9 @@ {{if $item.vote.dislike}} {{$item.vote.dislike.1}} {{/if}} + {{if $item.vote.announce}} + {{$item.vote.announce.1}} + {{/if}} {{if $item.vote.share}} {{$item.vote.share.1}} {{/if}} diff --git a/view/theme/smoothly/templates/wall_thread.tpl b/view/theme/smoothly/templates/wall_thread.tpl index 2e83a2482..1554a2ecb 100644 --- a/view/theme/smoothly/templates/wall_thread.tpl +++ b/view/theme/smoothly/templates/wall_thread.tpl @@ -95,8 +95,11 @@ {{if $item.vote.dislike}} {{/if}} + {{if $item.vote.announce}} + + {{/if}} {{if $item.vote.share}} - {{/if}} + {{/if}} {{/if}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 944aee77b..32b15de86 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -124,9 +124,11 @@ {{$item.vote.like.0}} {{/if}}{{if $item.vote.dislike}} {{$item.vote.dislike.0}} + {{/if}}{{if $item.vote.announce}} + {{$item.vote.dislike.0}} {{/if}} {{if $item.vote.share}} - {{$item.vote.share.0}} + {{$item.vote.share.0}} {{/if}} {{/if}}