Merge pull request #12644 from annando/improve-ignore

Improve the ignore behaviour
This commit is contained in:
Hypolite Petovan 2023-01-10 09:05:48 -05:00 committed by GitHub
commit f4b5d22396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 240 additions and 129 deletions

View File

@ -180,11 +180,13 @@ function item_insert(int $uid, array $request, bool $preview, string $return_pat
Logger::info('Public item stored for user', ['uri-id' => $toplevel_item['uri-id'], 'uid' => $post['uid'], 'stored' => $stored]);
}
$post['parent'] = $toplevel_item['id'];
$post['gravity'] = Item::GRAVITY_COMMENT;
$post['thr-parent'] = $parent_item['uri'];
$post['wall'] = $toplevel_item['wall'];
} else {
$parent_item = [];
$post['parent'] = 0;
$post['gravity'] = Item::GRAVITY_PARENT;
$post['thr-parent'] = $post['uri'];
}
@ -237,14 +239,6 @@ function item_process(array $post, array $request, bool $preview, string $return
$post = DI::contentItem()->addCategories($post, $request['category'] ?? '');
if (!$preview) {
if (Photo::setPermissionFromBody($post['body'], $post['uid'], $post['contact-id'], $post['allow_cid'], $post['allow_gid'], $post['deny_cid'], $post['deny_gid'])) {
$post['object-type'] = Activity\ObjectType::IMAGE;
}
$post = DI::contentItem()->moveAttachmentsFromBodyToAttach($post);
}
// Add the attachment to the body.
if (!empty($request['has_attachment'])) {
$post['body'] .= DI::contentItem()->storeAttachmentFromRequest($request);
@ -374,6 +368,22 @@ function item_content(App $a)
Contact\User::setBlocked($item['author-id'], DI::userSession()->getLocalUserId(), true);
if (DI::mode()->isAjax()) {
// ajax return: [<item id>, 0 (no perm) | <owner id>]
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);
} else {
item_redirect_after_action($item, $args->get(3));
}
break;
case 'ignore':
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
if (empty($item['author-id'])) {
throw new HTTPException\NotFoundException('Item not found');
}
Contact\User::setIgnored($item['author-id'], DI::userSession()->getLocalUserId(), true);
if (DI::mode()->isAjax()) {
// ajax return: [<item id>, 0 (no perm) | <owner id>]
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);

View File

@ -245,6 +245,7 @@ class Page implements ArrayAccess
'$generator' => 'Friendica' . ' ' . App::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.'),
'$ignoreAuthor' => $l10n->t('Ignore this author? You won\'t be able to see their posts and their notifications.'),
'$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon,

View File

@ -820,12 +820,6 @@ class Item
private static function prepareOriginPost(array $item): array
{
$item = DI::contentItem()->initializePost($item);
if (Photo::setPermissionFromBody($item['body'], $item['uid'], $item['contact-id'], $item['allow_cid'], $item['allow_gid'], $item['deny_cid'], $item['deny_gid'])) {
$item['object-type'] = Activity\ObjectType::IMAGE;
}
$item = DI::contentItem()->moveAttachmentsFromBodyToAttach($item);
$item = DI::contentItem()->finalizePost($item);
return $item;
@ -1052,6 +1046,14 @@ class Item
}
}
if ($notify) {
if (Photo::setPermissionFromBody($item['body'], $item['uid'], $item['contact-id'], $item['allow_cid'], $item['allow_gid'], $item['deny_cid'], $item['deny_gid'])) {
$item['object-type'] = Activity\ObjectType::IMAGE;
}
$item = DI::contentItem()->moveAttachmentsFromBodyToAttach($item);
}
$item['parent-uri-id'] = ItemURI::getIdByURI($item['parent-uri']);
$item['thr-parent-id'] = ItemURI::getIdByURI($item['thr-parent']);
@ -1333,6 +1335,19 @@ class Item
$transmit = $notify || ($posted_item['visible'] && ($parent_origin || $posted_item['origin']));
if ($transmit) {
if ($posted_item['uid'] && Contact\User::isBlocked($posted_item['author-id'], $posted_item['uid'])) {
Logger::info('Message from blocked author will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['author-id']]);
$transmit = false;
}
if ($transmit && $posted_item['uid'] && Contact\User::isBlocked($posted_item['owner-id'], $posted_item['uid'])) {
Logger::info('Message from blocked owner will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['owner-id']]);
$transmit = false;
}
if ($transmit && !empty($posted_item['causer-id']) && $posted_item['uid'] && Contact\User::isBlocked($posted_item['causer-id'], $posted_item['uid'])) {
Logger::info('Message from blocked causer will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['causer-id']]);
$transmit = false;
}
// Don't relay participation messages
if (($posted_item['verb'] == Activity::FOLLOW) &&
(!$posted_item['origin'] || ($posted_item['author-id'] != Contact::getPublicIdByUserId($uid)))) {
@ -3720,7 +3735,17 @@ class Item
return false;
}
if (!empty($item['causer-id']) && ($item['gravity'] === self::GRAVITY_PARENT) && Contact\User::isIgnored($item['causer-id'], $user_id)) {
if (!empty($item['author-id']) && Contact\User::isIgnored($item['author-id'], $user_id)) {
Logger::notice('Author is ignored by user', ['author-link' => $item['author-link'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false;
}
if (!empty($item['owner-id']) && Contact\User::isIgnored($item['owner-id'], $user_id)) {
Logger::notice('Owner is ignored by user', ['owner-link' => $item['owner-link'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false;
}
if (!empty($item['causer-id']) && Contact\User::isIgnored($item['causer-id'], $user_id)) {
Logger::notice('Causer is ignored by user', ['causer-link' => $item['causer-link'] ?? $item['causer-id'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false;
}

View File

@ -412,13 +412,13 @@ class Post
AND NOT `author-blocked` AND NOT `owner-blocked`
AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked`
AND ((NOT `contact-readonly` AND NOT `contact-pending` AND (`contact-rel` IN (?, ?)))
OR `self` OR `gravity` != ? OR `contact-uid` = ?)
OR `self` OR `contact-uid` = ?)
AND NOT `" . $view . "`.`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `uid` = ? AND `hidden`)
AND NOT `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `blocked` AND `cid` = `author-id`)
AND NOT `owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `blocked` AND `cid` = `owner-id`)
AND NOT (`gravity` = ? AND `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `ignored` AND `cid` = `author-id`))
AND NOT (`gravity` = ? AND `owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `ignored` AND `cid` = `owner-id`))",
0, Contact::SHARING, Contact::FRIEND, Item::GRAVITY_PARENT, 0, $uid, $uid, $uid, Item::GRAVITY_PARENT, $uid, Item::GRAVITY_PARENT, $uid]);
AND NOT `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `ignored` AND `cid` = `author-id`)
AND NOT `owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `ignored` AND `cid` = `owner-id`)",
0, Contact::SHARING, Contact::FRIEND, 0, $uid, $uid, $uid, $uid, $uid]);
$select_string = implode(', ', array_map([DBA::class, 'quoteIdentifier'], $selected));

View File

@ -133,12 +133,18 @@ class UserNotification
public static function setNotification(int $uri_id, int $uid)
{
$fields = ['id', 'uri-id', 'parent-uri-id', 'uid', 'body', 'parent', 'gravity', 'vid', 'gravity',
'private', 'contact-id', 'thr-parent', 'thr-parent-id', 'parent-uri-id', 'parent-uri', 'author-id', 'verb'];
'contact-id', 'author-id', 'owner-id', 'causer-id',
'private', 'thr-parent', 'thr-parent-id', 'parent-uri-id', 'parent-uri', 'verb'];
$item = Post::selectFirst($fields, ['uri-id' => $uri_id, 'uid' => $uid, 'origin' => false]);
if (!DBA::isResult($item)) {
return;
}
$parent = Post::selectFirstPost(['author-id', 'owner-id', 'causer-id'], ['uri-id' => $item['parent-uri-id']]);
if (!DBA::isResult($parent)) {
return;
}
// "Activity::FOLLOW" is an automated activity, so we ignore it here
if ($item['verb'] == Activity::FOLLOW) {
return;
@ -161,7 +167,7 @@ class UserNotification
DBA::close($users);
foreach (array_unique($uids) as $uid) {
self::setNotificationForUser($item, $uid);
self::setNotificationForUser($item, $parent, $uid);
}
}
@ -169,15 +175,26 @@ class UserNotification
* Checks an item for notifications for the given user and sets the "notification-type" field
*
* @param array $item Item array
* @param array $parent Parent item array
* @param int $uid User ID
* @throws HTTPException\InternalServerErrorException
*/
private static function setNotificationForUser(array $item, int $uid)
private static function setNotificationForUser(array $item, array $parent, int $uid)
{
if (Post\ThreadUser::getIgnored($item['parent-uri-id'], $uid)) {
return;
}
foreach (array_unique([$parent['author-id'], $parent['owner-id'], $parent['causer-id'], $item['author-id'], $item['owner-id'], $item['causer-id']]) as $author_id) {
if (empty($author_id)) {
continue;
}
if (Contact\User::isBlocked($author_id, $uid) || Contact\User::isIgnored($author_id, $uid) || Contact\User::isCollapsed($author_id, $uid)) {
Logger::debug('Author is blocked/ignored/collapsed by user', ['uid' => $uid, 'author' => $author_id, 'uri-id' => $item['uri-id']]);
return;
}
}
$user = User::getById($uid, ['account-type', 'account_removed', 'account_expired']);
if (in_array($user['account-type'], [User::ACCOUNT_TYPE_COMMUNITY, User::ACCOUNT_TYPE_RELAY])) {
return;

View File

@ -191,7 +191,7 @@ class Post
$pinned = '';
$pin = false;
$star = false;
$ignore = false;
$ignore_thread = false;
$ispinned = 'unpinned';
$isstarred = 'unstarred';
$indent = '';
@ -248,6 +248,7 @@ class Post
$drop = false;
$block = false;
$ignore = false;
if (DI::userSession()->getLocalUserId()) {
$drop = [
'dropping' => $dropping,
@ -263,6 +264,11 @@ class Post
'block' => 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']),
'author_id' => $item['author-id'],
];
}
$filer = DI::userSession()->getLocalUserId() ? DI::l10n()->t('Save to folder') : false;
@ -327,14 +333,14 @@ class Post
if ($this->isToplevel()) {
if (DI::userSession()->getLocalUserId()) {
$ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], DI::userSession()->getLocalUserId());
if ($item['mention'] || $ignored) {
$ignore = [
$ignored_thread = PostModel\ThreadUser::getIgnored($item['uri-id'], DI::userSession()->getLocalUserId());
if ($item['mention'] || $ignored_thread) {
$ignore_thread = [
'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',
'classdo' => $ignored_thread ? 'hidden' : '',
'classundo' => $ignored_thread ? '' : 'hidden',
'ignored' => DI::l10n()->t('Ignored'),
];
}
@ -518,12 +524,13 @@ class Post
'pinned' => $pinned,
'isstarred' => $isstarred,
'star' => $star,
'ignore' => $ignore,
'ignore' => $ignore_thread,
'tagger' => $tagger,
'filer' => $filer,
'language' => $languages,
'drop' => $drop,
'block' => $block,
'ignore_author' => $ignore,
'vote' => $buttons,
'like_html' => $responses['like']['output'],
'dislike_html' => $responses['dislike']['output'],

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2023.03-dev\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-09 16:24+0000\n"
"POT-Creation-Date: 2023-01-09 17:29+0000\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"
@ -38,13 +38,13 @@ msgstr ""
msgid "Empty post discarded."
msgstr ""
#: mod/item.php:401 src/Module/Admin/Themes/Details.php:39
#: mod/item.php:417 src/Module/Admin/Themes/Details.php:39
#: src/Module/Admin/Themes/Index.php:59 src/Module/Debug/ItemBody.php:42
#: src/Module/Debug/ItemBody.php:57 src/Module/Item/Feed.php:80
msgid "Item not found."
msgstr ""
#: mod/item.php:425 mod/message.php:69 mod/message.php:114 mod/notes.php:44
#: mod/item.php:441 mod/message.php:69 mod/message.php:114 mod/notes.php:44
#: mod/photos.php:158 mod/photos.php:675 src/Model/Event.php:522
#: src/Module/Attach.php:55 src/Module/BaseApi.php:95
#: src/Module/BaseNotifications.php:98 src/Module/BaseSettings.php:52
@ -294,7 +294,7 @@ msgstr ""
#: mod/message.php:203 mod/message.php:360 mod/photos.php:1297
#: src/Content/Conversation.php:371 src/Content/Conversation.php:717
#: src/Module/Item/Compose.php:204 src/Module/Post/Edit.php:142
#: src/Module/Profile/UnkMail.php:155 src/Object/Post.php:537
#: src/Module/Profile/UnkMail.php:155 src/Object/Post.php:544
msgid "Please wait"
msgstr ""
@ -311,7 +311,7 @@ msgstr ""
#: src/Module/Install.php:331 src/Module/Invite.php:178
#: src/Module/Item/Compose.php:189 src/Module/Moderation/Item/Source.php:79
#: src/Module/Profile/Profile.php:274 src/Module/Profile/UnkMail.php:156
#: src/Module/Settings/Profile/Index.php:231 src/Object/Post.php:986
#: src/Module/Settings/Profile/Index.php:231 src/Object/Post.php:993
#: view/theme/duepuntozero/config.php:85 view/theme/frio/config.php:171
#: view/theme/quattro/config.php:87 view/theme/vier/config.php:135
msgid "Submit"
@ -596,28 +596,28 @@ msgstr ""
#: mod/photos.php:1141 mod/photos.php:1197 mod/photos.php:1271
#: src/Module/Contact.php:589 src/Module/Item/Compose.php:188
#: src/Object/Post.php:983
#: src/Object/Post.php:990
msgid "This is you"
msgstr ""
#: mod/photos.php:1143 mod/photos.php:1199 mod/photos.php:1273
#: src/Object/Post.php:531 src/Object/Post.php:985
#: src/Object/Post.php:538 src/Object/Post.php:992
msgid "Comment"
msgstr ""
#: mod/photos.php:1145 mod/photos.php:1201 mod/photos.php:1275
#: src/Content/Conversation.php:386 src/Module/Calendar/Event/Form.php:248
#: src/Module/Item/Compose.php:199 src/Module/Post/Edit.php:162
#: src/Object/Post.php:997
#: src/Object/Post.php:1004
msgid "Preview"
msgstr ""
#: mod/photos.php:1146 src/Content/Conversation.php:341
#: src/Module/Post/Edit.php:127 src/Object/Post.php:987
#: src/Module/Post/Edit.php:127 src/Object/Post.php:994
msgid "Loading..."
msgstr ""
#: mod/photos.php:1232 src/Content/Conversation.php:633 src/Object/Post.php:255
#: mod/photos.php:1232 src/Content/Conversation.php:633 src/Object/Post.php:256
msgid "Select"
msgstr ""
@ -629,19 +629,19 @@ msgstr ""
msgid "Delete"
msgstr ""
#: mod/photos.php:1294 src/Object/Post.php:378
#: mod/photos.php:1294 src/Object/Post.php:384
msgid "Like"
msgstr ""
#: mod/photos.php:1295 src/Object/Post.php:378
#: mod/photos.php:1295 src/Object/Post.php:384
msgid "I like this (toggle)"
msgstr ""
#: mod/photos.php:1296 src/Object/Post.php:379
#: mod/photos.php:1296 src/Object/Post.php:385
msgid "Dislike"
msgstr ""
#: mod/photos.php:1298 src/Object/Post.php:379
#: mod/photos.php:1298 src/Object/Post.php:385
msgid "I don't like this (toggle)"
msgstr ""
@ -667,7 +667,13 @@ msgid ""
"posts, and you won't be able to see their posts and their notifications."
msgstr ""
#: src/App/Page.php:317
#: src/App/Page.php:248
msgid ""
"Ignore this author? You won't be able to see their posts and their "
"notifications."
msgstr ""
#: src/App/Page.php:318
msgid "toggle mobile"
msgstr ""
@ -1134,7 +1140,7 @@ msgid "Visible to <strong>everybody</strong>"
msgstr ""
#: src/Content/Conversation.php:311 src/Module/Item/Compose.php:198
#: src/Object/Post.php:996
#: src/Object/Post.php:1003
msgid "Please enter a image/video/audio/webpage URL:"
msgstr ""
@ -1179,42 +1185,42 @@ msgid "attach file"
msgstr ""
#: src/Content/Conversation.php:346 src/Module/Item/Compose.php:190
#: src/Module/Post/Edit.php:168 src/Object/Post.php:988
#: src/Module/Post/Edit.php:168 src/Object/Post.php:995
msgid "Bold"
msgstr ""
#: src/Content/Conversation.php:347 src/Module/Item/Compose.php:191
#: src/Module/Post/Edit.php:169 src/Object/Post.php:989
#: src/Module/Post/Edit.php:169 src/Object/Post.php:996
msgid "Italic"
msgstr ""
#: src/Content/Conversation.php:348 src/Module/Item/Compose.php:192
#: src/Module/Post/Edit.php:170 src/Object/Post.php:990
#: src/Module/Post/Edit.php:170 src/Object/Post.php:997
msgid "Underline"
msgstr ""
#: src/Content/Conversation.php:349 src/Module/Item/Compose.php:193
#: src/Module/Post/Edit.php:171 src/Object/Post.php:991
#: src/Module/Post/Edit.php:171 src/Object/Post.php:998
msgid "Quote"
msgstr ""
#: src/Content/Conversation.php:350 src/Module/Item/Compose.php:194
#: src/Module/Post/Edit.php:172 src/Object/Post.php:992
#: src/Module/Post/Edit.php:172 src/Object/Post.php:999
msgid "Code"
msgstr ""
#: src/Content/Conversation.php:351 src/Module/Item/Compose.php:195
#: src/Object/Post.php:993
#: src/Object/Post.php:1000
msgid "Image"
msgstr ""
#: src/Content/Conversation.php:352 src/Module/Item/Compose.php:196
#: src/Module/Post/Edit.php:173 src/Object/Post.php:994
#: src/Module/Post/Edit.php:173 src/Object/Post.php:1001
msgid "Link"
msgstr ""
#: src/Content/Conversation.php:353 src/Module/Item/Compose.php:197
#: src/Module/Post/Edit.php:174 src/Object/Post.php:995
#: src/Module/Post/Edit.php:174 src/Object/Post.php:1002
msgid "Link or Media"
msgstr ""
@ -1280,21 +1286,21 @@ msgstr ""
msgid "Pinned item"
msgstr ""
#: src/Content/Conversation.php:677 src/Object/Post.php:485
#: src/Object/Post.php:486
#: src/Content/Conversation.php:677 src/Object/Post.php:491
#: src/Object/Post.php:492
#, php-format
msgid "View %s's profile @ %s"
msgstr ""
#: src/Content/Conversation.php:690 src/Object/Post.php:473
#: src/Content/Conversation.php:690 src/Object/Post.php:479
msgid "Categories:"
msgstr ""
#: src/Content/Conversation.php:691 src/Object/Post.php:474
#: src/Content/Conversation.php:691 src/Object/Post.php:480
msgid "Filed under:"
msgstr ""
#: src/Content/Conversation.php:699 src/Object/Post.php:499
#: src/Content/Conversation.php:699 src/Object/Post.php:505
#, php-format
msgid "%s from %s"
msgstr ""
@ -1516,7 +1522,7 @@ msgstr ""
msgid "show more"
msgstr ""
#: src/Content/Item.php:326 src/Model/Item.php:2895
#: src/Content/Item.php:326 src/Model/Item.php:2908
msgid "event"
msgstr ""
@ -1525,7 +1531,7 @@ msgstr ""
msgid "status"
msgstr ""
#: src/Content/Item.php:335 src/Model/Item.php:2897
#: src/Content/Item.php:335 src/Model/Item.php:2910
#: src/Module/Post/Tag/Add.php:123
msgid "photo"
msgstr ""
@ -1588,7 +1594,7 @@ msgstr ""
msgid "Collapse"
msgstr ""
#: src/Content/Item.php:432 src/Object/Post.php:454
#: src/Content/Item.php:432 src/Object/Post.php:460
msgid "Languages"
msgstr ""
@ -1929,8 +1935,8 @@ msgid ""
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
msgstr ""
#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3564
#: src/Model/Item.php:3570 src/Model/Item.php:3571
#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3577
#: src/Model/Item.php:3583 src/Model/Item.php:3584
msgid "Link to source"
msgstr ""
@ -3099,71 +3105,71 @@ msgstr ""
msgid "Edit groups"
msgstr ""
#: src/Model/Item.php:1996
#: src/Model/Item.php:2009
#, php-format
msgid "Detected languages in this post:\\n%s"
msgstr ""
#: src/Model/Item.php:2899
#: src/Model/Item.php:2912
msgid "activity"
msgstr ""
#: src/Model/Item.php:2901
#: src/Model/Item.php:2914
msgid "comment"
msgstr ""
#: src/Model/Item.php:2904
#: src/Model/Item.php:2917
msgid "post"
msgstr ""
#: src/Model/Item.php:3054
#: src/Model/Item.php:3067
#, php-format
msgid "Content from %s is collapsed"
msgstr ""
#: src/Model/Item.php:3058
#: src/Model/Item.php:3071
#, php-format
msgid "Content warning: %s"
msgstr ""
#: src/Model/Item.php:3476
#: src/Model/Item.php:3489
msgid "bytes"
msgstr ""
#: src/Model/Item.php:3507
#: src/Model/Item.php:3520
#, php-format
msgid "%2$s (%3$d%%, %1$d vote)"
msgid_plural "%2$s (%3$d%%, %1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3509
#: src/Model/Item.php:3522
#, php-format
msgid "%2$s (%1$d vote)"
msgid_plural "%2$s (%1$d votes)"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3514
#: src/Model/Item.php:3527
#, php-format
msgid "%d voter. Poll end: %s"
msgid_plural "%d voters. Poll end: %s"
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3516
#: src/Model/Item.php:3529
#, php-format
msgid "%d voter."
msgid_plural "%d voters."
msgstr[0] ""
msgstr[1] ""
#: src/Model/Item.php:3518
#: src/Model/Item.php:3531
#, php-format
msgid "Poll end: %s"
msgstr ""
#: src/Model/Item.php:3552 src/Model/Item.php:3553
#: src/Model/Item.php:3565 src/Model/Item.php:3566
msgid "View on separate page"
msgstr ""
@ -5631,7 +5637,7 @@ msgid "Only show blocked contacts"
msgstr ""
#: src/Module/Contact.php:363 src/Module/Contact.php:418
#: src/Object/Post.php:338
#: src/Object/Post.php:344
msgid "Ignored"
msgstr ""
@ -6325,7 +6331,7 @@ msgstr ""
msgid "Posts that mention or involve you"
msgstr ""
#: src/Module/Conversation/Network.php:288 src/Object/Post.php:350
#: src/Module/Conversation/Network.php:288 src/Object/Post.php:356
msgid "Starred"
msgstr ""
@ -11111,173 +11117,178 @@ msgstr ""
msgid "Remove locally"
msgstr ""
#: src/Object/Post.php:263
#: src/Object/Post.php:264
#, php-format
msgid "Block %s"
msgstr ""
#: src/Object/Post.php:268
#: src/Object/Post.php:269
#, php-format
msgid "Ignore %s"
msgstr ""
#: src/Object/Post.php:274
msgid "Save to folder"
msgstr ""
#: src/Object/Post.php:303
#: src/Object/Post.php:309
msgid "I will attend"
msgstr ""
#: src/Object/Post.php:303
#: src/Object/Post.php:309
msgid "I will not attend"
msgstr ""
#: src/Object/Post.php:303
#: src/Object/Post.php:309
msgid "I might attend"
msgstr ""
#: src/Object/Post.php:333
#: src/Object/Post.php:339
msgid "Ignore thread"
msgstr ""
#: src/Object/Post.php:334
#: src/Object/Post.php:340
msgid "Unignore thread"
msgstr ""
#: src/Object/Post.php:335
#: src/Object/Post.php:341
msgid "Toggle ignore status"
msgstr ""
#: src/Object/Post.php:345
#: src/Object/Post.php:351
msgid "Add star"
msgstr ""
#: src/Object/Post.php:346
#: src/Object/Post.php:352
msgid "Remove star"
msgstr ""
#: src/Object/Post.php:347
#: src/Object/Post.php:353
msgid "Toggle star status"
msgstr ""
#: src/Object/Post.php:358
#: src/Object/Post.php:364
msgid "Pin"
msgstr ""
#: src/Object/Post.php:359
#: src/Object/Post.php:365
msgid "Unpin"
msgstr ""
#: src/Object/Post.php:360
#: src/Object/Post.php:366
msgid "Toggle pin status"
msgstr ""
#: src/Object/Post.php:363
#: src/Object/Post.php:369
msgid "Pinned"
msgstr ""
#: src/Object/Post.php:368
#: src/Object/Post.php:374
msgid "Add tag"
msgstr ""
#: src/Object/Post.php:381
#: src/Object/Post.php:387
msgid "Quote share this"
msgstr ""
#: src/Object/Post.php:381
#: src/Object/Post.php:387
msgid "Quote Share"
msgstr ""
#: src/Object/Post.php:384
#: src/Object/Post.php:390
msgid "Reshare this"
msgstr ""
#: src/Object/Post.php:384
#: src/Object/Post.php:390
msgid "Reshare"
msgstr ""
#: src/Object/Post.php:385
#: src/Object/Post.php:391
msgid "Cancel your Reshare"
msgstr ""
#: src/Object/Post.php:385
#: src/Object/Post.php:391
msgid "Unshare"
msgstr ""
#: src/Object/Post.php:432
#: src/Object/Post.php:438
#, php-format
msgid "%s (Received %s)"
msgstr ""
#: src/Object/Post.php:437
#: src/Object/Post.php:443
msgid "Comment this item on your system"
msgstr ""
#: src/Object/Post.php:437
#: src/Object/Post.php:443
msgid "Remote comment"
msgstr ""
#: src/Object/Post.php:458
#: src/Object/Post.php:464
msgid "Share via ..."
msgstr ""
#: src/Object/Post.php:458
#: src/Object/Post.php:464
msgid "Share via external services"
msgstr ""
#: src/Object/Post.php:487
#: src/Object/Post.php:493
msgid "to"
msgstr ""
#: src/Object/Post.php:488
#: src/Object/Post.php:494
msgid "via"
msgstr ""
#: src/Object/Post.php:489
#: src/Object/Post.php:495
msgid "Wall-to-Wall"
msgstr ""
#: src/Object/Post.php:490
#: src/Object/Post.php:496
msgid "via Wall-To-Wall:"
msgstr ""
#: src/Object/Post.php:532
#: src/Object/Post.php:539
#, php-format
msgid "Reply to %s"
msgstr ""
#: src/Object/Post.php:535
#: src/Object/Post.php:542
msgid "More"
msgstr ""
#: src/Object/Post.php:553
#: src/Object/Post.php:560
msgid "Notifier task is pending"
msgstr ""
#: src/Object/Post.php:554
#: src/Object/Post.php:561
msgid "Delivery to remote servers is pending"
msgstr ""
#: src/Object/Post.php:555
#: src/Object/Post.php:562
msgid "Delivery to remote servers is underway"
msgstr ""
#: src/Object/Post.php:556
#: src/Object/Post.php:563
msgid "Delivery to remote servers is mostly done"
msgstr ""
#: src/Object/Post.php:557
#: src/Object/Post.php:564
msgid "Delivery to remote servers is done"
msgstr ""
#: src/Object/Post.php:577
#: src/Object/Post.php:584
#, php-format
msgid "%d comment"
msgid_plural "%d comments"
msgstr[0] ""
msgstr[1] ""
#: src/Object/Post.php:578
#: src/Object/Post.php:585
msgid "Show more"
msgstr ""
#: src/Object/Post.php:579
#: src/Object/Post.php:586
msgid "Show fewer"
msgstr ""

View File

@ -202,6 +202,10 @@ function confirmBlock() {
return confirm(aStr.blockAuthor);
}
function confirmIgnore() {
return confirm(aStr.ignoreAuthor);
}
/**
* Hide and removes an item element from the DOM after the deletion url is
* successful, restore it else.
@ -258,4 +262,34 @@ function blockAuthor(url, elementId) {
});
}
}
/**
* Ignored 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 ignoreAuthor(url, elementId) {
if (confirmIgnore()) {
$("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");
});
});
}
}
// @license-end

View File

@ -8,5 +8,6 @@ They are loaded into the html <head> so that js functions can use them *}}
var aStr = {
'delitem' : "{{$delitem|escape:'javascript' nofilter}}",
'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}",
'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}",
};
</script>

View File

@ -404,6 +404,11 @@ as the value of $top_child_total (this is done at the end of this file)
<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}}
{{if $item.ignore_author}}
<li role="menuitem">
<a class="btn-link navicon ignore" href="javascript:ignoreAuthor('item/ignore/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.ignore_author.ignore}}"><i class="fa fa-ban" aria-hidden="true"></i> {{$item.ignore_author.ignore}}</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>