]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
The "thread" table isn't used anymore
[friendica.git] / src / Object / Post.php
index 00293d8ecb8b25646dbd7826732afdc4dae1dbab..d2c0b31e102b436e60adb731fb4ff93bba94d662 100644 (file)
@@ -230,6 +230,7 @@ class Post
                }
 
                $drop = false;
+               $block = false;
                if (local_user()) {
                        $drop = [
                                'dropping' => $dropping,
@@ -237,6 +238,11 @@ class Post
                                'select'   => DI::l10n()->t('Select'),
                                'delete'   => $delete,
                        ];
+                       $block = [
+                               'blocking' => true,
+                               'block'   => DI::l10n()->t('Block %s', $item['author-name']),
+                               'author_id'   => $item['author-id'],
+                       ];
                }
 
                $filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t("save to folder") : false);
@@ -281,8 +287,8 @@ class Post
                $responses = [];
                foreach ($response_verbs as $value => $verb) {
                        $responses[$verb] = [
-                               'self'   => $conv_responses[$verb][$item['uri']]['self'] ?? 0,
-                               'output' => !empty($conv_responses[$verb][$item['uri']]) ? format_activity($conv_responses[$verb][$item['uri']]['links'], $verb, $item['uri']) : '',
+                               'self'   => $conv_responses[$verb][$item['uri-id']]['self'] ?? 0,
+                               'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? format_activity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id']) : '',
                        ];
                }
 
@@ -301,17 +307,15 @@ class Post
 
                if ($this->isToplevel()) {
                        if(local_user()) {
-                               $thread = PostModel::selectFirstThreadForUser(local_user(), ['ignored'], ['iid' => $item['id']]);
-                               if (DBA::isResult($thread)) {
-                                       $ignore = [
-                                               'do'        => DI::l10n()->t("ignore thread"),
-                                               'undo'      => DI::l10n()->t("unignore thread"),
-                                               'toggle'    => DI::l10n()->t("toggle ignore status"),
-                                               'classdo'   => $thread['ignored'] ? "hidden" : "",
-                                               'classundo' => $thread['ignored'] ? "" : "hidden",
-                                               'ignored'   => DI::l10n()->t('ignored'),
-                                       ];
-                               }
+                               $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
+                               $ignore = [
+                                       'do'        => DI::l10n()->t("ignore thread"),
+                                       'undo'      => DI::l10n()->t("unignore thread"),
+                                       'toggle'    => DI::l10n()->t("toggle ignore status"),
+                                       'classdo'   => $ignored ? "hidden" : "",
+                                       'classundo' => $ignored ? "" : "hidden",
+                                       'ignored'   => DI::l10n()->t('ignored'),
+                               ];
 
                                if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
                                        if ($origin) {
@@ -485,6 +489,7 @@ class Post
                        'filer'           => $filer,
                        'language'        => $languages,
                        'drop'            => $drop,
+                       'block'           => $block,
                        'vote'            => $buttons,
                        'like_html'       => $responses['like']['output'],
                        'dislike_html'    => $responses['dislike']['output'],