]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Merge pull request #13476 from MrPetovan/bug/13467-image-reliable-dimensions
[friendica.git] / src / Object / Post.php
index 28db238949b24c54c0f11adc5150feb01f8b96cc..dd3074cfa32a0e06d4ac785b35e4b10c5f93cc03 100644 (file)
@@ -31,16 +31,15 @@ use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
-use Friendica\Model\Photo;
 use Friendica\Model\Post as PostModel;
 use Friendica\Model\Tag;
 use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
+use GuzzleHttp\Psr7\Uri;
 use InvalidArgumentException;
 
 /**
@@ -248,38 +247,47 @@ class Post
                        $pinned = DI::l10n()->t('Pinned item');
                }
 
-               // Showing the one or the other text, depending upon if we can only hide it or really delete it.
-               $delete = $origin ? DI::l10n()->t('Delete globally') : DI::l10n()->t('Remove locally');
-
-               $drop     = false;
-               $block    = false;
-               $ignore   = false;
-               $collapse = false;
+               $drop         = false;
+               $block        = false;
+               $ignore       = false;
+               $collapse     = false;
+               $report       = false;
+               $ignoreServer = false;
                if (DI::userSession()->getLocalUserId()) {
                        $drop = [
                                'dropping' => $dropping,
                                'pagedrop' => $item['pagedrop'],
                                'select' => DI::l10n()->t('Select'),
-                               'delete' => $delete,
+                               'label' => $origin ? DI::l10n()->t('Delete globally') : DI::l10n()->t('Remove locally'),
                        ];
                }
 
                if (!$item['self'] && DI::userSession()->getLocalUserId()) {
                        $block = [
                                'blocking'  => true,
-                               'block'     => DI::l10n()->t('Block %s', $item['author-name']),
+                               'label'     => DI::l10n()->t('Block %s', $item['author-name']),
                                'author_id' => $item['author-id'],
                        ];
                        $ignore = [
                                'ignoring'  => true,
-                               'ignore'    => DI::l10n()->t('Ignore %s', $item['author-name']),
+                               'label'     => DI::l10n()->t('Ignore %s', $item['author-name']),
                                'author_id' => $item['author-id'],
                        ];
                        $collapse = [
                                'collapsing' => true,
-                               'collapse'   => DI::l10n()->t('Collapse %s', $item['author-name']),
+                               'label'      => DI::l10n()->t('Collapse %s', $item['author-name']),
                                'author_id'  => $item['author-id'],
                        ];
+                       $report = [
+                               'label' => DI::l10n()->t('Report post'),
+                               'href'  => 'moderation/report/create?' . http_build_query(['cid' => $item['author-id'], 'uri-ids' => [$item['uri-id']]]),
+                       ];
+                       $authorBaseUri = new Uri($item['author-baseurl'] ?? '');
+                       if ($authorBaseUri->getHost() && !DI::baseUrl()->isLocalUrl($authorBaseUri)) {
+                               $ignoreServer = [
+                                       'label' => DI::l10n()->t("Ignore %s server", $authorBaseUri->getHost()),
+                               ];
+                       }
                }
 
                $filer = DI::userSession()->getLocalUserId() ? DI::l10n()->t('Save to folder') : false;
@@ -554,6 +562,8 @@ class Post
                        'block'           => $block,
                        'ignore_author'   => $ignore,
                        'collapse'        => $collapse,
+                       'report'          => $report,
+                       'ignore_server'     => $ignoreServer,
                        'vote'            => $buttons,
                        'like_html'       => $responses['like']['output'],
                        'dislike_html'    => $responses['dislike']['output'],
@@ -568,6 +578,7 @@ class Post
                        'wait'            => DI::l10n()->t('Please wait'),
                        'thread_level'    => $thread_level,
                        'edited'          => $edited,
+                       'author_gsid'     => $item['author-gsid'],
                        'network'         => $item['network'],
                        'network_name'    => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']),
                        'network_icon'    => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']),