]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
API: Support for reshared items
[friendica.git] / src / Object / Post.php
index 51b952d610481dc326793d3e83fd5164e7bfd79c..83dc0c0944184972c462451c9db372bec943824a 100644 (file)
@@ -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,12 @@ 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, Protocol::DIASPORA, Protocol::TWITTER]);
+
+               // On Diaspora only toplevel posts can be reshared
+               if ($announceable && ($item['network'] == Protocol::DIASPORA) && ($item['gravity'] != GRAVITY_PARENT)) {
+                       $announceable = false;
+               }
 
                $edpost = false;
 
@@ -344,7 +351,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('Quote and share this'), DI::l10n()->t('Quote Share')];
+                       }
+                       if ($announceable) {
+                               $buttons['announce'] = [DI::l10n()->t('Share this'), DI::l10n()->t('Share')];
                        }
                }
 
@@ -411,6 +421,11 @@ class Post
                        }
                }
 
+               $languages = [];
+               if (!empty($item['language'])) {
+                       $languages = [DI::l10n()->t('Languages'), Item::getLanguageMessage($item)];
+               }
+
                $tmp_item = [
                        'template'        => $this->getTemplate(),
                        'type'            => implode("", array_slice(explode("/", $item['verb']), -1)),
@@ -466,6 +481,7 @@ class Post
                        'ignore'          => $ignore,
                        'tagger'          => $tagger,
                        'filer'           => $filer,
+                       'language'        => $languages,
                        'drop'            => $drop,
                        'vote'            => $buttons,
                        'like_html'       => $responses['like']['output'],