1
0
Fork 0

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]); 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['gravity'] = Item::GRAVITY_COMMENT;
$post['thr-parent'] = $parent_item['uri']; $post['thr-parent'] = $parent_item['uri'];
$post['wall'] = $toplevel_item['wall']; $post['wall'] = $toplevel_item['wall'];
} else { } else {
$parent_item = []; $parent_item = [];
$post['parent'] = 0;
$post['gravity'] = Item::GRAVITY_PARENT; $post['gravity'] = Item::GRAVITY_PARENT;
$post['thr-parent'] = $post['uri']; $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'] ?? ''); $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. // Add the attachment to the body.
if (!empty($request['has_attachment'])) { if (!empty($request['has_attachment'])) {
$post['body'] .= DI::contentItem()->storeAttachmentFromRequest($request); $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); 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()) { if (DI::mode()->isAjax()) {
// ajax return: [<item id>, 0 (no perm) | <owner id>] // ajax return: [<item id>, 0 (no perm) | <owner id>]
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]); System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);

View file

@ -245,6 +245,7 @@ class Page implements ArrayAccess
'$generator' => 'Friendica' . ' ' . App::VERSION, '$generator' => 'Friendica' . ' ' . App::VERSION,
'$delitem' => $l10n->t('Delete this item?'), '$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.'), '$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, '$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon, '$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon, '$touch_icon' => $touch_icon,

View file

@ -820,12 +820,6 @@ class Item
private static function prepareOriginPost(array $item): array private static function prepareOriginPost(array $item): array
{ {
$item = DI::contentItem()->initializePost($item); $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); $item = DI::contentItem()->finalizePost($item);
return $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['parent-uri-id'] = ItemURI::getIdByURI($item['parent-uri']);
$item['thr-parent-id'] = ItemURI::getIdByURI($item['thr-parent']); $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'])); $transmit = $notify || ($posted_item['visible'] && ($parent_origin || $posted_item['origin']));
if ($transmit) { 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 // Don't relay participation messages
if (($posted_item['verb'] == Activity::FOLLOW) && if (($posted_item['verb'] == Activity::FOLLOW) &&
(!$posted_item['origin'] || ($posted_item['author-id'] != Contact::getPublicIdByUserId($uid)))) { (!$posted_item['origin'] || ($posted_item['author-id'] != Contact::getPublicIdByUserId($uid)))) {
@ -3720,7 +3735,17 @@ class Item
return false; 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']]); Logger::notice('Causer is ignored by user', ['causer-link' => $item['causer-link'] ?? $item['causer-id'], 'uid' => $user_id, 'item-uri' => $item['uri']]);
return false; return false;
} }

View file

@ -412,13 +412,13 @@ class Post
AND NOT `author-blocked` AND NOT `owner-blocked` 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 `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 (?, ?))) 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 `" . $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 `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 `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 `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`))", AND NOT `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]); 0, Contact::SHARING, Contact::FRIEND, 0, $uid, $uid, $uid, $uid, $uid]);
$select_string = implode(', ', array_map([DBA::class, 'quoteIdentifier'], $selected)); $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) public static function setNotification(int $uri_id, int $uid)
{ {
$fields = ['id', 'uri-id', 'parent-uri-id', 'uid', 'body', 'parent', 'gravity', 'vid', 'gravity', $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]); $item = Post::selectFirst($fields, ['uri-id' => $uri_id, 'uid' => $uid, 'origin' => false]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
return; 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 // "Activity::FOLLOW" is an automated activity, so we ignore it here
if ($item['verb'] == Activity::FOLLOW) { if ($item['verb'] == Activity::FOLLOW) {
return; return;
@ -161,23 +167,34 @@ class UserNotification
DBA::close($users); DBA::close($users);
foreach (array_unique($uids) as $uid) { foreach (array_unique($uids) as $uid) {
self::setNotificationForUser($item, $uid); self::setNotificationForUser($item, $parent, $uid);
} }
} }
/** /**
* Checks an item for notifications for the given user and sets the "notification-type" field * Checks an item for notifications for the given user and sets the "notification-type" field
* *
* @param array $item Item array * @param array $item Item array
* @param int $uid User ID * @param array $parent Parent item array
* @param int $uid User ID
* @throws HTTPException\InternalServerErrorException * @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)) { if (Post\ThreadUser::getIgnored($item['parent-uri-id'], $uid)) {
return; 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']); $user = User::getById($uid, ['account-type', 'account_removed', 'account_expired']);
if (in_array($user['account-type'], [User::ACCOUNT_TYPE_COMMUNITY, User::ACCOUNT_TYPE_RELAY])) { if (in_array($user['account-type'], [User::ACCOUNT_TYPE_COMMUNITY, User::ACCOUNT_TYPE_RELAY])) {
return; return;

View file

@ -191,7 +191,7 @@ class Post
$pinned = ''; $pinned = '';
$pin = false; $pin = false;
$star = false; $star = false;
$ignore = false; $ignore_thread = false;
$ispinned = 'unpinned'; $ispinned = 'unpinned';
$isstarred = 'unstarred'; $isstarred = 'unstarred';
$indent = ''; $indent = '';
@ -246,8 +246,9 @@ class Post
// Showing the one or the other text, depending upon if we can only hide it or really delete it. // 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'); $delete = $origin ? DI::l10n()->t('Delete globally') : DI::l10n()->t('Remove locally');
$drop = false; $drop = false;
$block = false; $block = false;
$ignore = false;
if (DI::userSession()->getLocalUserId()) { if (DI::userSession()->getLocalUserId()) {
$drop = [ $drop = [
'dropping' => $dropping, 'dropping' => $dropping,
@ -259,9 +260,14 @@ class Post
if (!$item['self'] && DI::userSession()->getLocalUserId()) { if (!$item['self'] && DI::userSession()->getLocalUserId()) {
$block = [ $block = [
'blocking' => true, 'blocking' => true,
'block' => DI::l10n()->t('Block %s', $item['author-name']), 'block' => DI::l10n()->t('Block %s', $item['author-name']),
'author_id' => $item['author-id'], 'author_id' => $item['author-id'],
];
$ignore = [
'ignoring' => true,
'ignore' => DI::l10n()->t('Ignore %s', $item['author-name']),
'author_id' => $item['author-id'],
]; ];
} }
@ -327,14 +333,14 @@ class Post
if ($this->isToplevel()) { if ($this->isToplevel()) {
if (DI::userSession()->getLocalUserId()) { if (DI::userSession()->getLocalUserId()) {
$ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], DI::userSession()->getLocalUserId()); $ignored_thread = PostModel\ThreadUser::getIgnored($item['uri-id'], DI::userSession()->getLocalUserId());
if ($item['mention'] || $ignored) { if ($item['mention'] || $ignored_thread) {
$ignore = [ $ignore_thread = [
'do' => DI::l10n()->t('Ignore thread'), 'do' => DI::l10n()->t('Ignore thread'),
'undo' => DI::l10n()->t('Unignore thread'), 'undo' => DI::l10n()->t('Unignore thread'),
'toggle' => DI::l10n()->t('Toggle ignore status'), 'toggle' => DI::l10n()->t('Toggle ignore status'),
'classdo' => $ignored ? 'hidden' : '', 'classdo' => $ignored_thread ? 'hidden' : '',
'classundo' => $ignored ? '' : 'hidden', 'classundo' => $ignored_thread ? '' : 'hidden',
'ignored' => DI::l10n()->t('Ignored'), 'ignored' => DI::l10n()->t('Ignored'),
]; ];
} }
@ -518,12 +524,13 @@ class Post
'pinned' => $pinned, 'pinned' => $pinned,
'isstarred' => $isstarred, 'isstarred' => $isstarred,
'star' => $star, 'star' => $star,
'ignore' => $ignore, 'ignore' => $ignore_thread,
'tagger' => $tagger, 'tagger' => $tagger,
'filer' => $filer, 'filer' => $filer,
'language' => $languages, 'language' => $languages,
'drop' => $drop, 'drop' => $drop,
'block' => $block, 'block' => $block,
'ignore_author' => $ignore,
'vote' => $buttons, 'vote' => $buttons,
'like_html' => $responses['like']['output'], 'like_html' => $responses['like']['output'],
'dislike_html' => $responses['dislike']['output'], 'dislike_html' => $responses['dislike']['output'],

View file

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

View file

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

View file

@ -6,7 +6,8 @@ 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 localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
var aStr = { var aStr = {
'delitem' : "{{$delitem|escape:'javascript' nofilter}}", 'delitem' : "{{$delitem|escape:'javascript' nofilter}}",
'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}", 'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}",
'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}",
}; };
</script> </script>

View file

@ -404,7 +404,12 @@ 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> <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> </li>
{{/if}} {{/if}}
</ul> {{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;" /> <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</span> </span>
{{else}} {{else}}