]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #9833 from MrPetovan/task/9719-frio-block-author-more
authorMichael Vogel <icarus@dabo.de>
Sat, 23 Jan 2021 11:50:44 +0000 (12:50 +0100)
committerGitHub <noreply@github.com>
Sat, 23 Jan 2021 11:50:44 +0000 (12:50 +0100)
[frio] Add block author in post more dropdown

mod/item.php
src/App/Page.php
src/Object/Post.php
view/lang/C/messages.po
view/theme/frio/js/textedit.js
view/theme/frio/templates/js_strings.tpl
view/theme/frio/templates/wall_thread.tpl

index 68fa6fbf6dfe284ea529e8907d13149ffb8830e7..8d329f475b569ab8825d67582de3eb8ea82bea3a 100644 (file)
@@ -819,24 +819,50 @@ function item_post_return($baseurl, $api_source, $return_path)
 function item_content(App $a)
 {
        if (!Session::isAuthenticated()) {
-               return;
+               throw new HTTPException\UnauthorizedException();
+       }
+
+       $args = DI::args();
+
+       if (!$args->has(3)) {
+               throw new HTTPException\BadRequestException();
        }
 
        $o = '';
+       switch ($args->get(1)) {
+               case 'drop':
+                       if (DI::mode()->isAjax()) {
+                               Item::deleteForUser(['id' => $args->get(2)], local_user());
+                               // ajax return: [<item id>, 0 (no perm) | <owner id>]
+                               System::jsonExit([intval($args->get(2)), local_user()]);
+                       } else {
+                               if (!empty($args->get(3))) {
+                                       $o = drop_item($args->get(2), $args->get(3));
+                               } else {
+                                       $o = drop_item($args->get(2));
+                               }
+                       }
+                       break;
+               case 'block':
+                       $item = Post::selectFirstForUser(local_user(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
+                       if (empty($item['author-id'])) {
+                               throw new HTTPException\NotFoundException('Item not found');
+                       }
 
-       if (($a->argc >= 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
-               if (DI::mode()->isAjax()) {
-                       Item::deleteForUser(['id' => $a->argv[2]], local_user());
-                       // ajax return: [<item id>, 0 (no perm) | <owner id>]
-                       System::jsonExit([intval($a->argv[2]), local_user()]);
-               } else {
-                       if (!empty($a->argv[3])) {
-                               $o = drop_item($a->argv[2], $a->argv[3]);
+                       $cdata = Contact::getPublicAndUserContacID($item['author-id'], local_user());
+                       if (empty($cdata['user'])) {
+                               throw new HTTPException\NotFoundException('Contact not found');
                        }
-                       else {
-                               $o = drop_item($a->argv[2]);
+
+                       Contact::block($cdata['user'], DI::l10n()->t('Blocked on item with guid %s', $item['guid']));
+
+                       if (DI::mode()->isAjax()) {
+                               // ajax return: [<item id>, 0 (no perm) | <owner id>]
+                               System::jsonExit([intval($args->get(2)), local_user()]);
+                       } else {
+                               item_redirect_after_action($item, $args->get(3));
                        }
-               }
+                       break;
        }
 
        return $o;
@@ -871,39 +897,10 @@ function drop_item(int $id, string $return = '')
        }
 
        if ((local_user() == $item['uid']) || $contact_id) {
-               if (!empty($item['parent'])) {
-                       $parentitem = Post::selectFirstForUser(local_user(), ['guid'], ['id' => $item['parent']]);
-               }
-
                // delete the item
                Item::deleteForUser(['id' => $item['id']], local_user());
 
-               $return_url = hex2bin($return);
-
-               // removes update_* from return_url to ignore Ajax refresh
-               $return_url = str_replace("update_", "", $return_url);
-
-               // Check if delete a comment
-               if ($item['gravity'] == GRAVITY_COMMENT) {
-                       // Return to parent guid
-                       if (!empty($parentitem)) {
-                               DI::baseUrl()->redirect('display/' . $parentitem['guid']);
-                               //NOTREACHED
-                       } // In case something goes wrong
-                       else {
-                               DI::baseUrl()->redirect('network');
-                               //NOTREACHED
-                       }
-               } else {
-                       // if unknown location or deleting top level post called from display
-                       if (empty($return_url) || strpos($return_url, 'display') !== false) {
-                               DI::baseUrl()->redirect('network');
-                               //NOTREACHED
-                       } else {
-                               DI::baseUrl()->redirect($return_url);
-                               //NOTREACHED
-                       }
-               }
+               item_redirect_after_action($item, $return);
        } else {
                notice(DI::l10n()->t('Permission denied.'));
                DI::baseUrl()->redirect('display/' . $item['guid']);
@@ -912,3 +909,37 @@ function drop_item(int $id, string $return = '')
 
        return '';
 }
+
+function item_redirect_after_action($item, $returnUrlHex)
+{
+       $return_url = hex2bin($returnUrlHex);
+
+       // removes update_* from return_url to ignore Ajax refresh
+       $return_url = str_replace("update_", "", $return_url);
+
+       // Check if delete a comment
+       if ($item['gravity'] == GRAVITY_COMMENT) {
+               if (!empty($item['parent'])) {
+                       $parentitem = Post::selectFirstForUser(local_user(), ['guid'], ['id' => $item['parent']]);
+               }
+
+               // Return to parent guid
+               if (!empty($parentitem)) {
+                       DI::baseUrl()->redirect('display/' . $parentitem['guid']);
+                       //NOTREACHED
+               } // In case something goes wrong
+               else {
+                       DI::baseUrl()->redirect('network');
+                       //NOTREACHED
+               }
+       } else {
+               // if unknown location or deleting top level post called from display
+               if (empty($return_url) || strpos($return_url, 'display') !== false) {
+                       DI::baseUrl()->redirect('network');
+                       //NOTREACHED
+               } else {
+                       DI::baseUrl()->redirect($return_url);
+                       //NOTREACHED
+               }
+       }
+}
index af1f1810b705d36e92d966aaac1e7e85679584f7..8a1ec47d55edfc19caeb0726e16db5aa5ab60bcb 100644 (file)
@@ -248,6 +248,7 @@ class Page implements ArrayAccess
                        '$local_user'      => local_user(),
                        '$generator'       => 'Friendica' . ' ' . FRIENDICA_VERSION,
                        '$delitem'         => $l10n->t('Delete this item?'),
+                       '$blockAuthor'     => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
                        '$update_interval' => $interval,
                        '$shortcut_icon'   => $shortcut_icon,
                        '$touch_icon'      => $touch_icon,
index 00293d8ecb8b25646dbd7826732afdc4dae1dbab..925f752c9a4592b481a6587cce14ce36d18aa8b5 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);
@@ -485,6 +491,7 @@ class Post
                        'filer'           => $filer,
                        'language'        => $languages,
                        'drop'            => $drop,
+                       'block'           => $block,
                        'vote'            => $buttons,
                        'like_html'       => $responses['like']['output'],
                        'dislike_html'    => $responses['dislike']['output'],
index b0b6d2c1272b621a7e3ca786da4f70cfaa93b033..e080c5ff95953b4e109a11048b37accbf25940c5 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2021.03-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-01-21 10:38-0500\n"
+"POT-Creation-Date: 2021-01-23 05:36-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -54,7 +54,7 @@ msgstr ""
 msgid "%1$s poked %2$s"
 msgstr ""
 
-#: include/conversation.php:222 src/Model/Item.php:2789
+#: include/conversation.php:222 src/Model/Item.php:2763
 msgid "event"
 msgstr ""
 
@@ -62,7 +62,7 @@ msgstr ""
 msgid "status"
 msgstr ""
 
-#: include/conversation.php:230 mod/tagger.php:90 src/Model/Item.php:2791
+#: include/conversation.php:230 mod/tagger.php:90 src/Model/Item.php:2765
 msgid "photo"
 msgstr ""
 
@@ -71,7 +71,7 @@ msgstr ""
 msgid "%1$s tagged %2$s's %3$s with %4$s"
 msgstr ""
 
-#: include/conversation.php:560 mod/photos.php:1468 src/Object/Post.php:237
+#: include/conversation.php:560 mod/photos.php:1468 src/Object/Post.php:238
 msgid "Select"
 msgstr ""
 
@@ -82,20 +82,20 @@ msgstr ""
 msgid "Delete"
 msgstr ""
 
-#: include/conversation.php:596 src/Object/Post.php:451 src/Object/Post.php:452
+#: include/conversation.php:596 src/Object/Post.php:457 src/Object/Post.php:458
 #, php-format
 msgid "View %s's profile @ %s"
 msgstr ""
 
-#: include/conversation.php:609 src/Object/Post.php:439
+#: include/conversation.php:609 src/Object/Post.php:445
 msgid "Categories:"
 msgstr ""
 
-#: include/conversation.php:610 src/Object/Post.php:440
+#: include/conversation.php:610 src/Object/Post.php:446
 msgid "Filed under:"
 msgstr ""
 
-#: include/conversation.php:617 src/Object/Post.php:465
+#: include/conversation.php:617 src/Object/Post.php:471
 #, php-format
 msgid "%s from %s"
 msgstr ""
@@ -105,9 +105,9 @@ msgid "View in context"
 msgstr ""
 
 #: include/conversation.php:634 include/conversation.php:1216
-#: mod/editpost.php:106 mod/message.php:205 mod/message.php:375
+#: mod/editpost.php:104 mod/message.php:205 mod/message.php:375
 #: mod/photos.php:1534 mod/wallmessage.php:155 src/Module/Item/Compose.php:159
-#: src/Object/Post.php:498
+#: src/Object/Post.php:505
 msgid "Please wait"
 msgstr ""
 
@@ -228,7 +228,7 @@ msgstr ""
 msgid "Ignore"
 msgstr ""
 
-#: include/conversation.php:954 src/Object/Post.php:428
+#: include/conversation.php:954 src/Object/Post.php:434
 msgid "Languages"
 msgstr ""
 
@@ -336,7 +336,7 @@ msgid "Visible to <strong>everybody</strong>"
 msgstr ""
 
 #: include/conversation.php:1177 src/Module/Item/Compose.php:153
-#: src/Object/Post.php:965
+#: src/Object/Post.php:972
 msgid "Please enter a image/video/audio/webpage URL:"
 msgstr ""
 
@@ -344,7 +344,7 @@ msgstr ""
 msgid "Tag term:"
 msgstr ""
 
-#: include/conversation.php:1179 src/Module/Filer/SaveTag.php:65
+#: include/conversation.php:1179 src/Module/Filer/SaveTag.php:69
 msgid "Save to Folder:"
 msgstr ""
 
@@ -364,115 +364,115 @@ msgstr ""
 msgid "Share"
 msgstr ""
 
-#: include/conversation.php:1195 mod/editpost.php:91 mod/photos.php:1382
-#: src/Module/Contact/Poke.php:154 src/Object/Post.php:956
+#: include/conversation.php:1195 mod/editpost.php:89 mod/photos.php:1382
+#: src/Module/Contact/Poke.php:154 src/Object/Post.php:963
 msgid "Loading..."
 msgstr ""
 
-#: include/conversation.php:1196 mod/editpost.php:92 mod/message.php:203
+#: include/conversation.php:1196 mod/editpost.php:90 mod/message.php:203
 #: mod/message.php:372 mod/wallmessage.php:153
 msgid "Upload photo"
 msgstr ""
 
-#: include/conversation.php:1197 mod/editpost.php:93
+#: include/conversation.php:1197 mod/editpost.php:91
 msgid "upload photo"
 msgstr ""
 
-#: include/conversation.php:1198 mod/editpost.php:94
+#: include/conversation.php:1198 mod/editpost.php:92
 msgid "Attach file"
 msgstr ""
 
-#: include/conversation.php:1199 mod/editpost.php:95
+#: include/conversation.php:1199 mod/editpost.php:93
 msgid "attach file"
 msgstr ""
 
 #: include/conversation.php:1200 src/Module/Item/Compose.php:145
-#: src/Object/Post.php:957
+#: src/Object/Post.php:964
 msgid "Bold"
 msgstr ""
 
 #: include/conversation.php:1201 src/Module/Item/Compose.php:146
-#: src/Object/Post.php:958
+#: src/Object/Post.php:965
 msgid "Italic"
 msgstr ""
 
 #: include/conversation.php:1202 src/Module/Item/Compose.php:147
-#: src/Object/Post.php:959
+#: src/Object/Post.php:966
 msgid "Underline"
 msgstr ""
 
 #: include/conversation.php:1203 src/Module/Item/Compose.php:148
-#: src/Object/Post.php:960
+#: src/Object/Post.php:967
 msgid "Quote"
 msgstr ""
 
 #: include/conversation.php:1204 src/Module/Item/Compose.php:149
-#: src/Object/Post.php:961
+#: src/Object/Post.php:968
 msgid "Code"
 msgstr ""
 
 #: include/conversation.php:1205 src/Module/Item/Compose.php:150
-#: src/Object/Post.php:962
+#: src/Object/Post.php:969
 msgid "Image"
 msgstr ""
 
 #: include/conversation.php:1206 src/Module/Item/Compose.php:151
-#: src/Object/Post.php:963
+#: src/Object/Post.php:970
 msgid "Link"
 msgstr ""
 
 #: include/conversation.php:1207 src/Module/Item/Compose.php:152
-#: src/Object/Post.php:964
+#: src/Object/Post.php:971
 msgid "Link or Media"
 msgstr ""
 
-#: include/conversation.php:1208 mod/editpost.php:102
+#: include/conversation.php:1208 mod/editpost.php:100
 #: src/Module/Item/Compose.php:155
 msgid "Set your location"
 msgstr ""
 
-#: include/conversation.php:1209 mod/editpost.php:103
+#: include/conversation.php:1209 mod/editpost.php:101
 msgid "set location"
 msgstr ""
 
-#: include/conversation.php:1210 mod/editpost.php:104
+#: include/conversation.php:1210 mod/editpost.php:102
 msgid "Clear browser location"
 msgstr ""
 
-#: include/conversation.php:1211 mod/editpost.php:105
+#: include/conversation.php:1211 mod/editpost.php:103
 msgid "clear location"
 msgstr ""
 
-#: include/conversation.php:1213 mod/editpost.php:119
+#: include/conversation.php:1213 mod/editpost.php:117
 #: src/Module/Item/Compose.php:160
 msgid "Set title"
 msgstr ""
 
-#: include/conversation.php:1215 mod/editpost.php:121
+#: include/conversation.php:1215 mod/editpost.php:119
 #: src/Module/Item/Compose.php:161
 msgid "Categories (comma-separated list)"
 msgstr ""
 
-#: include/conversation.php:1217 mod/editpost.php:107
+#: include/conversation.php:1217 mod/editpost.php:105
 msgid "Permission settings"
 msgstr ""
 
-#: include/conversation.php:1218 mod/editpost.php:136 mod/events.php:578
+#: include/conversation.php:1218 mod/editpost.php:134 mod/events.php:578
 #: mod/photos.php:969 mod/photos.php:1335
 msgid "Permissions"
 msgstr ""
 
-#: include/conversation.php:1227 mod/editpost.php:116
+#: include/conversation.php:1227 mod/editpost.php:114
 msgid "Public post"
 msgstr ""
 
-#: include/conversation.php:1231 mod/editpost.php:127 mod/events.php:573
+#: include/conversation.php:1231 mod/editpost.php:125 mod/events.php:573
 #: mod/photos.php:1381 mod/photos.php:1438 mod/photos.php:1511
-#: src/Module/Item/Compose.php:154 src/Object/Post.php:966
+#: src/Module/Item/Compose.php:154 src/Object/Post.php:973
 msgid "Preview"
 msgstr ""
 
-#: include/conversation.php:1235 mod/dfrn_request.php:643 mod/editpost.php:130
+#: include/conversation.php:1235 mod/dfrn_request.php:643 mod/editpost.php:128
 #: mod/fbrowser.php:105 mod/fbrowser.php:134 mod/follow.php:152
 #: mod/photos.php:1037 mod/photos.php:1143 mod/settings.php:504
 #: mod/settings.php:530 mod/tagrm.php:37 mod/tagrm.php:127 mod/unfollow.php:100
@@ -480,16 +480,16 @@ msgstr ""
 msgid "Cancel"
 msgstr ""
 
-#: include/conversation.php:1242 mod/editpost.php:134 src/Model/Profile.php:445
+#: include/conversation.php:1242 mod/editpost.php:132 src/Model/Profile.php:445
 #: src/Module/Contact.php:344
 msgid "Message"
 msgstr ""
 
-#: include/conversation.php:1243 mod/editpost.php:135
+#: include/conversation.php:1243 mod/editpost.php:133
 msgid "Browser"
 msgstr ""
 
-#: include/conversation.php:1245 mod/editpost.php:138
+#: include/conversation.php:1245 mod/editpost.php:136
 msgid "Open Compose page"
 msgstr ""
 
@@ -818,9 +818,9 @@ msgstr ""
 msgid "Please visit %s to approve or reject the request."
 msgstr ""
 
-#: mod/api.php:52 mod/api.php:57 mod/dfrn_confirm.php:79 mod/editpost.php:39
+#: mod/api.php:52 mod/api.php:57 mod/dfrn_confirm.php:79 mod/editpost.php:37
 #: mod/events.php:231 mod/follow.php:55 mod/follow.php:135 mod/item.php:183
-#: mod/item.php:188 mod/item.php:917 mod/message.php:70 mod/message.php:113
+#: mod/item.php:188 mod/item.php:905 mod/message.php:70 mod/message.php:113
 #: mod/notes.php:44 mod/ostatus_subscribe.php:30 mod/photos.php:176
 #: mod/photos.php:922 mod/repair_ostatus.php:31 mod/settings.php:47
 #: mod/settings.php:65 mod/settings.php:493 mod/suggest.php:34
@@ -1211,49 +1211,49 @@ msgstr ""
 msgid "The feed for this item is unavailable."
 msgstr ""
 
-#: mod/editpost.php:46 mod/editpost.php:56
+#: mod/editpost.php:44 mod/editpost.php:54
 msgid "Item not found"
 msgstr ""
 
-#: mod/editpost.php:63
+#: mod/editpost.php:61
 msgid "Edit post"
 msgstr ""
 
-#: mod/editpost.php:90 mod/notes.php:63 src/Content/Text/HTML.php:881
-#: src/Module/Filer/SaveTag.php:66
+#: mod/editpost.php:88 mod/notes.php:63 src/Content/Text/HTML.php:881
+#: src/Module/Filer/SaveTag.php:70
 msgid "Save"
 msgstr ""
 
-#: mod/editpost.php:96 mod/message.php:204 mod/message.php:373
+#: mod/editpost.php:94 mod/message.php:204 mod/message.php:373
 #: mod/wallmessage.php:154
 msgid "Insert web link"
 msgstr ""
 
-#: mod/editpost.php:97
+#: mod/editpost.php:95
 msgid "web link"
 msgstr ""
 
-#: mod/editpost.php:98
+#: mod/editpost.php:96
 msgid "Insert video link"
 msgstr ""
 
-#: mod/editpost.php:99
+#: mod/editpost.php:97
 msgid "video link"
 msgstr ""
 
-#: mod/editpost.php:100
+#: mod/editpost.php:98
 msgid "Insert audio link"
 msgstr ""
 
-#: mod/editpost.php:101
+#: mod/editpost.php:99
 msgid "audio link"
 msgstr ""
 
-#: mod/editpost.php:115 src/Core/ACL.php:312
+#: mod/editpost.php:113 src/Core/ACL.php:312
 msgid "CC: email addresses"
 msgstr ""
 
-#: mod/editpost.php:122 src/Core/ACL.php:313
+#: mod/editpost.php:120 src/Core/ACL.php:313
 msgid "Example: bob@example.com, mary@example.com"
 msgstr ""
 
@@ -1341,7 +1341,7 @@ msgstr ""
 #: src/Module/Install.php:234 src/Module/Install.php:276
 #: src/Module/Install.php:313 src/Module/Invite.php:175
 #: src/Module/Item/Compose.php:144 src/Module/Profile/Profile.php:242
-#: src/Module/Settings/Profile/Index.php:237 src/Object/Post.php:955
+#: src/Module/Settings/Profile/Index.php:237 src/Object/Post.php:962
 #: view/theme/duepuntozero/config.php:69 view/theme/frio/config.php:160
 #: view/theme/quattro/config.php:71 view/theme/vier/config.php:119
 msgid "Submit"
@@ -1424,19 +1424,24 @@ msgstr ""
 msgid "Empty post discarded."
 msgstr ""
 
-#: mod/item.php:706
+#: mod/item.php:700
 msgid "Post updated."
 msgstr ""
 
-#: mod/item.php:723 mod/item.php:728
+#: mod/item.php:717 mod/item.php:722
 msgid "Item wasn't stored."
 msgstr ""
 
-#: mod/item.php:739
+#: mod/item.php:733
 msgid "Item couldn't be fetched."
 msgstr ""
 
-#: mod/item.php:867 src/Module/Admin/Themes/Details.php:39
+#: mod/item.php:857
+#, php-format
+msgid "Blocked on item with guid %s"
+msgstr ""
+
+#: mod/item.php:884 src/Module/Admin/Themes/Details.php:39
 #: src/Module/Admin/Themes/Index.php:59 src/Module/Debug/ItemBody.php:47
 #: src/Module/Debug/ItemBody.php:60
 msgid "Item not found."
@@ -1751,7 +1756,7 @@ msgstr ""
 msgid "failed"
 msgstr ""
 
-#: mod/ostatus_subscribe.php:98 src/Object/Post.php:312
+#: mod/ostatus_subscribe.php:98 src/Object/Post.php:318
 msgid "ignored"
 msgstr ""
 
@@ -1968,12 +1973,12 @@ msgstr ""
 
 #: mod/photos.php:1377 mod/photos.php:1434 mod/photos.php:1507
 #: src/Module/Contact.php:1096 src/Module/Item/Compose.php:142
-#: src/Object/Post.php:952
+#: src/Object/Post.php:959
 msgid "This is you"
 msgstr ""
 
 #: mod/photos.php:1379 mod/photos.php:1436 mod/photos.php:1509
-#: src/Object/Post.php:492 src/Object/Post.php:954
+#: src/Object/Post.php:499 src/Object/Post.php:961
 msgid "Comment"
 msgstr ""
 
@@ -1981,7 +1986,7 @@ msgstr ""
 msgid "Like"
 msgstr ""
 
-#: mod/photos.php:1532 src/Object/Post.php:352
+#: mod/photos.php:1532 src/Object/Post.php:358
 msgid "I like this (toggle)"
 msgstr ""
 
@@ -1989,7 +1994,7 @@ msgstr ""
 msgid "Dislike"
 msgstr ""
 
-#: mod/photos.php:1535 src/Object/Post.php:353
+#: mod/photos.php:1535 src/Object/Post.php:359
 msgid "I don't like this (toggle)"
 msgstr ""
 
@@ -2380,7 +2385,7 @@ msgstr ""
 msgid "Unable to find your profile. Please contact your admin."
 msgstr ""
 
-#: mod/settings.php:757 src/Content/Widget.php:543
+#: mod/settings.php:757 src/Content/Widget.php:529
 msgid "Account Types"
 msgstr ""
 
@@ -2932,7 +2937,7 @@ msgstr ""
 msgid "No videos selected"
 msgstr ""
 
-#: mod/videos.php:252 src/Model/Item.php:2978
+#: mod/videos.php:252 src/Model/Item.php:2952
 msgid "View Video"
 msgstr ""
 
@@ -2999,7 +3004,13 @@ msgstr ""
 msgid "Delete this item?"
 msgstr ""
 
-#: src/App/Page.php:298
+#: src/App/Page.php:251
+msgid ""
+"Block this author? They won't be able to follow you nor see your public "
+"posts, and you won't be able to see their posts and their notifications."
+msgstr ""
+
+#: src/App/Page.php:299
 msgid "toggle mobile"
 msgstr ""
 
@@ -3319,7 +3330,7 @@ msgid "Display membership date in profile"
 msgstr ""
 
 #: src/Content/ForumManager.php:145 src/Content/Nav.php:229
-#: src/Content/Text/HTML.php:902 src/Content/Widget.php:540
+#: src/Content/Text/HTML.php:902 src/Content/Widget.php:526
 msgid "Forums"
 msgstr ""
 
@@ -3327,12 +3338,12 @@ msgstr ""
 msgid "External link to forum"
 msgstr ""
 
-#: src/Content/ForumManager.php:150 src/Content/Widget.php:519
+#: src/Content/ForumManager.php:150 src/Content/Widget.php:505
 msgid "show less"
 msgstr ""
 
-#: src/Content/ForumManager.php:151 src/Content/Widget.php:424
-#: src/Content/Widget.php:520
+#: src/Content/ForumManager.php:151 src/Content/Widget.php:410
+#: src/Content/Widget.php:506
 msgid "show more"
 msgstr ""
 
@@ -3623,8 +3634,8 @@ msgid ""
 "<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
 msgstr ""
 
-#: src/Content/Text/BBCode.php:1088 src/Model/Item.php:3046
-#: src/Model/Item.php:3052
+#: src/Content/Text/BBCode.php:1088 src/Model/Item.php:3020
+#: src/Model/Item.php:3026
 msgid "link to source"
 msgstr ""
 
@@ -3794,42 +3805,42 @@ msgstr ""
 msgid "All Protocols"
 msgstr ""
 
-#: src/Content/Widget.php:324
+#: src/Content/Widget.php:315
 msgid "Saved Folders"
 msgstr ""
 
-#: src/Content/Widget.php:326 src/Content/Widget.php:365
+#: src/Content/Widget.php:317 src/Content/Widget.php:351
 msgid "Everything"
 msgstr ""
 
-#: src/Content/Widget.php:363
+#: src/Content/Widget.php:349
 msgid "Categories"
 msgstr ""
 
-#: src/Content/Widget.php:420
+#: src/Content/Widget.php:406
 #, php-format
 msgid "%d contact in common"
 msgid_plural "%d contacts in common"
 msgstr[0] ""
 msgstr[1] ""
 
-#: src/Content/Widget.php:513
+#: src/Content/Widget.php:499
 msgid "Archives"
 msgstr ""
 
-#: src/Content/Widget.php:537
+#: src/Content/Widget.php:523
 msgid "Persons"
 msgstr ""
 
-#: src/Content/Widget.php:538
+#: src/Content/Widget.php:524
 msgid "Organisations"
 msgstr ""
 
-#: src/Content/Widget.php:539 src/Model/Contact.php:1402
+#: src/Content/Widget.php:525 src/Model/Contact.php:1402
 msgid "News"
 msgstr ""
 
-#: src/Content/Widget.php:544 src/Module/Admin/BaseUsers.php:50
+#: src/Content/Widget.php:530 src/Module/Admin/BaseUsers.php:50
 msgid "All"
 msgstr ""
 
@@ -4748,39 +4759,39 @@ msgstr ""
 msgid "Edit groups"
 msgstr ""
 
-#: src/Model/Item.php:1785
+#: src/Model/Item.php:1760
 #, php-format
 msgid "Detected languages in this post:\\n%s"
 msgstr ""
 
-#: src/Model/Item.php:2793
+#: src/Model/Item.php:2767
 msgid "activity"
 msgstr ""
 
-#: src/Model/Item.php:2795 src/Object/Post.php:551
+#: src/Model/Item.php:2769 src/Object/Post.php:558
 msgid "comment"
 msgid_plural "comments"
 msgstr[0] ""
 msgstr[1] ""
 
-#: src/Model/Item.php:2798
+#: src/Model/Item.php:2772
 msgid "post"
 msgstr ""
 
-#: src/Model/Item.php:2922
+#: src/Model/Item.php:2896
 #, php-format
 msgid "Content warning: %s"
 msgstr ""
 
-#: src/Model/Item.php:2995
+#: src/Model/Item.php:2969
 msgid "bytes"
 msgstr ""
 
-#: src/Model/Item.php:3040
+#: src/Model/Item.php:3014
 msgid "View on separate page"
 msgstr ""
 
-#: src/Model/Item.php:3041
+#: src/Model/Item.php:3015
 msgid "view on separate page"
 msgstr ""
 
@@ -8069,7 +8080,7 @@ msgstr ""
 msgid "Twitter Source"
 msgstr ""
 
-#: src/Module/Debug/Feed.php:38 src/Module/Filer/SaveTag.php:38
+#: src/Module/Debug/Feed.php:38 src/Module/Filer/SaveTag.php:40
 #: src/Module/Settings/Profile/Index.php:158
 msgid "You must be logged in to use this module"
 msgstr ""
@@ -8149,15 +8160,15 @@ msgstr ""
 msgid "Site Directory"
 msgstr ""
 
-#: src/Module/Filer/RemoveTag.php:63
+#: src/Module/Filer/RemoveTag.php:69
 msgid "Item was not removed"
 msgstr ""
 
-#: src/Module/Filer/RemoveTag.php:66
+#: src/Module/Filer/RemoveTag.php:72
 msgid "Item was not deleted"
 msgstr ""
 
-#: src/Module/Filer/SaveTag.php:65
+#: src/Module/Filer/SaveTag.php:69
 msgid "- select -"
 msgstr ""
 
@@ -10096,180 +10107,185 @@ msgstr ""
 msgid "Remove locally"
 msgstr ""
 
-#: src/Object/Post.php:242
+#: src/Object/Post.php:243
+#, php-format
+msgid "Block %s"
+msgstr ""
+
+#: src/Object/Post.php:248
 msgid "save to folder"
 msgstr ""
 
-#: src/Object/Post.php:277
+#: src/Object/Post.php:283
 msgid "I will attend"
 msgstr ""
 
-#: src/Object/Post.php:277
+#: src/Object/Post.php:283
 msgid "I will not attend"
 msgstr ""
 
-#: src/Object/Post.php:277
+#: src/Object/Post.php:283
 msgid "I might attend"
 msgstr ""
 
-#: src/Object/Post.php:307
+#: src/Object/Post.php:313
 msgid "ignore thread"
 msgstr ""
 
-#: src/Object/Post.php:308
+#: src/Object/Post.php:314
 msgid "unignore thread"
 msgstr ""
 
-#: src/Object/Post.php:309
+#: src/Object/Post.php:315
 msgid "toggle ignore status"
 msgstr ""
 
-#: src/Object/Post.php:321
+#: src/Object/Post.php:327
 msgid "pin"
 msgstr ""
 
-#: src/Object/Post.php:322
+#: src/Object/Post.php:328
 msgid "unpin"
 msgstr ""
 
-#: src/Object/Post.php:323
+#: src/Object/Post.php:329
 msgid "toggle pin status"
 msgstr ""
 
-#: src/Object/Post.php:326
+#: src/Object/Post.php:332
 msgid "pinned"
 msgstr ""
 
-#: src/Object/Post.php:333
+#: src/Object/Post.php:339
 msgid "add star"
 msgstr ""
 
-#: src/Object/Post.php:334
+#: src/Object/Post.php:340
 msgid "remove star"
 msgstr ""
 
-#: src/Object/Post.php:335
+#: src/Object/Post.php:341
 msgid "toggle star status"
 msgstr ""
 
-#: src/Object/Post.php:338
+#: src/Object/Post.php:344
 msgid "starred"
 msgstr ""
 
-#: src/Object/Post.php:342
+#: src/Object/Post.php:348
 msgid "add tag"
 msgstr ""
 
-#: src/Object/Post.php:352
+#: src/Object/Post.php:358
 msgid "like"
 msgstr ""
 
-#: src/Object/Post.php:353
+#: src/Object/Post.php:359
 msgid "dislike"
 msgstr ""
 
-#: src/Object/Post.php:355
+#: src/Object/Post.php:361
 msgid "Quote share this"
 msgstr ""
 
-#: src/Object/Post.php:355
+#: src/Object/Post.php:361
 msgid "Quote Share"
 msgstr ""
 
-#: src/Object/Post.php:358
+#: src/Object/Post.php:364
 msgid "Reshare this"
 msgstr ""
 
-#: src/Object/Post.php:358
+#: src/Object/Post.php:364
 msgid "Reshare"
 msgstr ""
 
-#: src/Object/Post.php:359
+#: src/Object/Post.php:365
 msgid "Cancel your Reshare"
 msgstr ""
 
-#: src/Object/Post.php:359
+#: src/Object/Post.php:365
 msgid "Unshare"
 msgstr ""
 
-#: src/Object/Post.php:404
+#: src/Object/Post.php:410
 #, php-format
 msgid "%s (Received %s)"
 msgstr ""
 
-#: src/Object/Post.php:409
+#: src/Object/Post.php:415
 msgid "Comment this item on your system"
 msgstr ""
 
-#: src/Object/Post.php:409
+#: src/Object/Post.php:415
 msgid "remote comment"
 msgstr ""
 
-#: src/Object/Post.php:421
+#: src/Object/Post.php:427
 msgid "Pushed"
 msgstr ""
 
-#: src/Object/Post.php:421
+#: src/Object/Post.php:427
 msgid "Pulled"
 msgstr ""
 
-#: src/Object/Post.php:453
+#: src/Object/Post.php:459
 msgid "to"
 msgstr ""
 
-#: src/Object/Post.php:454
+#: src/Object/Post.php:460
 msgid "via"
 msgstr ""
 
-#: src/Object/Post.php:455
+#: src/Object/Post.php:461
 msgid "Wall-to-Wall"
 msgstr ""
 
-#: src/Object/Post.php:456
+#: src/Object/Post.php:462
 msgid "via Wall-To-Wall:"
 msgstr ""
 
-#: src/Object/Post.php:493
+#: src/Object/Post.php:500
 #, php-format
 msgid "Reply to %s"
 msgstr ""
 
-#: src/Object/Post.php:496
+#: src/Object/Post.php:503
 msgid "More"
 msgstr ""
 
-#: src/Object/Post.php:514
+#: src/Object/Post.php:521
 msgid "Notifier task is pending"
 msgstr ""
 
-#: src/Object/Post.php:515
+#: src/Object/Post.php:522
 msgid "Delivery to remote servers is pending"
 msgstr ""
 
-#: src/Object/Post.php:516
+#: src/Object/Post.php:523
 msgid "Delivery to remote servers is underway"
 msgstr ""
 
-#: src/Object/Post.php:517
+#: src/Object/Post.php:524
 msgid "Delivery to remote servers is mostly done"
 msgstr ""
 
-#: src/Object/Post.php:518
+#: src/Object/Post.php:525
 msgid "Delivery to remote servers is done"
 msgstr ""
 
-#: src/Object/Post.php:538
+#: src/Object/Post.php:545
 #, php-format
 msgid "%d comment"
 msgid_plural "%d comments"
 msgstr[0] ""
 msgstr[1] ""
 
-#: src/Object/Post.php:539
+#: src/Object/Post.php:546
 msgid "Show more"
 msgstr ""
 
-#: src/Object/Post.php:540
+#: src/Object/Post.php:547
 msgid "Show fewer"
 msgstr ""
 
index 39e7f4428ffc22839a7b11d8c11241d05c158682..014f6504fdbda0bfd47638bf00cf5586723b0b72 100644 (file)
@@ -198,6 +198,10 @@ function confirmDelete() {
        return confirm(aStr.delitem);
 }
 
+function confirmBlock() {
+       return confirm(aStr.blockAuthor);
+}
+
 /**
  * Hide and removes an item element from the DOM after the deletion url is
  * successful, restore it else.
@@ -207,9 +211,34 @@ function confirmDelete() {
  * @returns {undefined}
  */
 function dropItem(url, elementId) {
-       var confirm = confirmDelete();
+       if (confirmDelete()) {
+               $("body").css("cursor", "wait");
+
+               var $el = $(document.getElementById(elementId));
+
+               $el.fadeTo('fast', 0.33, function () {
+                       $.get(url).then(function() {
+                               $el.remove();
+                       }).fail(function() {
+                               // @todo Show related error message
+                               $el.show();
+                       }).always(function() {
+                               $("body").css('cursor', 'auto');
+                       });
+               });
+       }
+}
 
-       if (confirm) {
+/**
+ * Blocks an author and hide and removes an item element from the DOM after the block is
+ * successful, restore it else.
+ *
+ * @param {string} url The item removal URL
+ * @param {string} elementId The DOM id of the item element
+ * @returns {undefined}
+ */
+function blockAuthor(url, elementId) {
+       if (confirmBlock()) {
                $("body").css("cursor", "wait");
 
                var $el = $(document.getElementById(elementId));
index b649159b9b984e146a5e8cfe06421489039bf273..066e4bd58525521a8c543ba1cea23d50b7ddc20c 100644 (file)
@@ -6,6 +6,7 @@ They are loaded into the html <head> so that js functions can use them *}}
 
        var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
        var aStr = {
-               'delitem'     : "{{$delitem}}",
+               'delitem'     : "{{$delitem|escape:'javascript' nofilter}}",
+               'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}",
        };
 </script>
index 99316fce3e702a3aa62161999be10ee61c6d7aed..25d6885fc8c23180ecd0422d23013715afc1761e 100644 (file)
@@ -393,6 +393,12 @@ as the value of $top_child_total (this is done at the end of this file)
                                                        <a class="btn-link navicon delete" href="javascript:dropItem('item/drop/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash" aria-hidden="true"></i> {{$item.drop.delete}}</a>
                                                </li>
                                                {{/if}}
+
+                                               {{if $item.block}}
+                                               <li role="menuitem">
+                                                       <a class="btn-link navicon block" href="javascript:blockAuthor('item/block/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.block.block}}"><i class="fa fa-ban" aria-hidden="true"></i> {{$item.block.block}}</a>
+                                               </li>
+                                               {{/if}}
                                        </ul>
                                        <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
                                </span>