From 50e43c530e019bce5defda2a4503a9a817d8772f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 17:40:05 +0000 Subject: [PATCH 1/8] Posts from contacts can now be collapsed --- src/Content/Item.php | 12 +- src/Model/Item.php | 3 + src/Module/Contact.php | 24 +- src/Module/Contact/Profile.php | 25 ++ static/routes.config.php | 2 +- update.php | 1 + view/lang/C/messages.po | 308 +++++++++++---------- view/templates/contact_edit.tpl | 2 + view/theme/frio/templates/contact_edit.tpl | 2 + 9 files changed, 229 insertions(+), 150 deletions(-) diff --git a/src/Content/Item.php b/src/Content/Item.php index a60b12663..26df55fd0 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -398,10 +398,11 @@ class Item } if (!empty($pcid)) { - $contact_url = 'contact/' . $pcid; - $posts_link = $contact_url . '/posts'; - $block_link = $item['self'] ? '' : $contact_url . '/block?t=' . $formSecurityToken; - $ignore_link = $item['self'] ? '' : $contact_url . '/ignore?t=' . $formSecurityToken; + $contact_url = 'contact/' . $pcid; + $posts_link = $contact_url . '/posts'; + $block_link = $item['self'] ? '' : $contact_url . '/block?t=' . $formSecurityToken; + $ignore_link = $item['self'] ? '' : $contact_url . '/ignore?t=' . $formSecurityToken; + $collapse_link = $item['self'] ? '' : $contact_url . '/collapse?t=' . $formSecurityToken; } if ($cid && !$item['self']) { @@ -423,7 +424,8 @@ class Item $this->l10n->t('View Contact') => $contact_url, $this->l10n->t('Send PM') => $pm_url, $this->l10n->t('Block') => $block_link, - $this->l10n->t('Ignore') => $ignore_link + $this->l10n->t('Ignore') => $ignore_link, + $this->l10n->t('Collapse') => $collapse_link ]; if (!empty($item['language'])) { diff --git a/src/Model/Item.php b/src/Model/Item.php index 1eaa7cff2..8b1002fb2 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3048,6 +3048,9 @@ class Item // Compile eventual content filter reasons $filter_reasons = []; if (!$is_preview && DI::userSession()->getPublicContactId() != $item['author-id']) { + if (Contact\User::isCollapsed($item['author-id'], $item['uid'])) { + $filter_reasons[] = DI::l10n()->t('Content from %s is collapsed', $item['author-name']); + } if (!empty($item['content-warning']) && (!DI::userSession()->getLocalUserId() || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'disable_cw', false))) { $filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index d848c749e..23a2e9c49 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -87,6 +87,11 @@ class Contact extends BaseModule self::toggleIgnoreContact($cdata['public']); $count_actions++; } + + if (!empty($_POST['contacts_batch_collapse'])) { + self::toggleCollapseContact($cdata['public']); + $count_actions++; + } } if ($count_actions > 0) { DI::sysmsg()->addInfo(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions)); @@ -165,6 +170,18 @@ class Contact extends BaseModule Model\Contact\User::setIgnored($contact_id, DI::userSession()->getLocalUserId(), $ignored); } + /** + * Toggles the collapsed status of a contact identified by id. + * + * @param int $contact_id Id of the contact with uid = 0 + * @throws \Exception + */ + private static function toggleCollapseContact(int $contact_id) + { + $collapsed = !Model\Contact\User::isCollapsed($contact_id, DI::userSession()->getLocalUserId()); + Model\Contact\User::setCollapsed($contact_id, DI::userSession()->getLocalUserId(), $collapsed); + } + protected function content(array $request = []): string { if (!DI::userSession()->getLocalUserId()) { @@ -405,9 +422,10 @@ class Contact extends BaseModule '$form_security_token' => BaseModule::getFormSecurityToken('contact_batch_actions'), 'multiselect' => 1, '$batch_actions' => [ - 'contacts_batch_update' => DI::l10n()->t('Update'), - 'contacts_batch_block' => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'), - 'contacts_batch_ignore' => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'), + 'contacts_batch_update' => DI::l10n()->t('Update'), + 'contacts_batch_block' => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'), + 'contacts_batch_ignore' => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'), + 'contacts_batch_collapse' => DI::l10n()->t('Collapse') . '/' . DI::l10n()->t('Uncollapse'), ], '$h_batch_actions' => DI::l10n()->t('Batch Actions'), '$paginate' => $pager->renderFull($total), diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 736761f88..886798a5f 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -197,7 +197,23 @@ class Profile extends BaseModule Contact\User::setIgnored($contact['id'], DI::userSession()->getLocalUserId(), true); $message = $this->t('Contact has been ignored'); } + + // @TODO: add $this->localRelationship->save($localRelationship); + DI::sysmsg()->addInfo($message); + } + if ($cmd === 'collapse') { + if ($localRelationship->collapsed) { + // @TODO Backward compatibility, replace with $localRelationship->unblock() + Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), false); + + $message = $this->t('Contact has been collapsed'); + } else { + // @TODO Backward compatibility, replace with $localRelationship->block() + Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), true); + $message = $this->t('Contact has been collapsed'); + } + // @TODO: add $this->localRelationship->save($localRelationship); DI::sysmsg()->addInfo($message); } @@ -352,6 +368,7 @@ class Profile extends BaseModule '$cinfo' => ['info', '', $localRelationship->info, ''], '$blocked' => ($contact['blocked'] ? $this->t('Currently blocked') : ''), '$ignored' => ($contact['readonly'] ? $this->t('Currently ignored') : ''), + '$collapsed' => (Contact\User::isCollapsed($contact['id'], DI::userSession()->getLocalUserId()) ? $this->t('Currently collapsed') : ''), '$archived' => ($contact['archive'] ? $this->t('Currently archived') : ''), '$pending' => ($contact['pending'] ? $this->t('Awaiting connection acknowledge') : ''), '$hidden' => ['hidden', $this->t('Hide this contact from others'), $localRelationship->hidden, $this->t('Replies/likes to your public posts may still be visible')], @@ -479,6 +496,14 @@ class Profile extends BaseModule 'id' => 'toggle-ignore', ]; + $contact_actions['collapse'] = [ + 'label' => $localRelationship->collapsed ? $this->t('Uncollapse') : $this->t('Collapse'), + 'url' => 'contact/' . $contact['id'] . '/collapse?t=' . $formSecurityToken, + 'title' => $this->t('Toggle Collapsed status'), + 'sel' => $localRelationship->collapsed ? 'active' : '', + 'id' => 'toggle-collapse', + ]; + if (Protocol::supportsRevokeFollow($contact['network']) && in_array($localRelationship->rel, [Contact::FOLLOWER, Contact::FRIEND])) { $contact_actions['revoke_follow'] = [ 'label' => $this->t('Revoke Follow'), diff --git a/static/routes.config.php b/static/routes.config.php index 634b90b23..51030c6a7 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -386,7 +386,7 @@ return [ '/contact' => [ '[/]' => [Module\Contact::class, [R::GET]], '/{id:\d+}[/]' => [Module\Contact\Profile::class, [R::GET, R::POST]], - '/{id:\d+}/{action:block|ignore|update|updateprofile}' + '/{id:\d+}/{action:block|ignore|collapse|update|updateprofile}' => [Module\Contact\Profile::class, [R::GET]], '/{id:\d+}/advanced' => [Module\Contact\Advanced::class, [R::GET, R::POST]], '/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]], diff --git a/update.php b/update.php index cf94b5679..0491e4a92 100644 --- a/update.php +++ b/update.php @@ -1202,6 +1202,7 @@ function update_1509() $newConfig = DI::config()->beginTransaction(); foreach ($addons as $addon) { + print_r($addon); $newConfig->set('addons', $addon['name'], [ 'last_update' => $addon['timestamp'], 'admin' => (bool)$addon['plugin_admin'], diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index ab6101923..eaf8dacd0 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-07 17:15+0000\n" +"POT-Creation-Date: 2023-01-08 17:39+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,34 +18,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" -#: mod/item.php:101 mod/item.php:105 mod/item.php:178 mod/item.php:182 -#: src/Content/Item.php:860 +#: mod/item.php:101 mod/item.php:104 mod/item.php:170 mod/item.php:173 +#: src/Content/Item.php:862 msgid "Unable to locate original post." msgstr "" -#: mod/item.php:139 +#: mod/item.php:138 msgid "Post updated." msgstr "" -#: mod/item.php:213 mod/item.php:218 +#: mod/item.php:201 mod/item.php:205 msgid "Item wasn't stored." msgstr "" -#: mod/item.php:228 +#: mod/item.php:215 msgid "Item couldn't be fetched." msgstr "" -#: mod/item.php:273 mod/item.php:278 +#: mod/item.php:261 mod/item.php:265 msgid "Empty post discarded." msgstr "" -#: mod/item.php:414 src/Module/Admin/Themes/Details.php:39 +#: mod/item.php:401 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:438 mod/message.php:69 mod/message.php:114 mod/notes.php:44 +#: mod/item.php:425 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 @@ -303,7 +303,7 @@ msgstr "" #: mod/photos.php:825 mod/photos.php:1103 mod/photos.php:1144 #: mod/photos.php:1200 mod/photos.php:1274 #: src/Module/Calendar/Event/Form.php:250 src/Module/Contact/Advanced.php:132 -#: src/Module/Contact/Profile.php:327 +#: src/Module/Contact/Profile.php:343 #: src/Module/Debug/ActivityPubConversion.php:140 #: src/Module/Debug/Babel.php:313 src/Module/Debug/Localtime.php:64 #: src/Module/Debug/Probe.php:54 src/Module/Debug/WebFinger.php:51 @@ -596,7 +596,7 @@ msgid "Rotate CCW (left)" msgstr "" #: mod/photos.php:1141 mod/photos.php:1197 mod/photos.php:1271 -#: src/Module/Contact.php:557 src/Module/Item/Compose.php:188 +#: src/Module/Contact.php:575 src/Module/Item/Compose.php:188 #: src/Object/Post.php:983 msgid "This is you" msgstr "" @@ -696,16 +696,16 @@ msgid "All contacts" msgstr "" #: src/BaseModule.php:432 src/Content/Widget.php:235 src/Core/ACL.php:194 -#: src/Module/Contact.php:378 src/Module/PermissionTooltip.php:122 +#: src/Module/Contact.php:395 src/Module/PermissionTooltip.php:122 #: src/Module/PermissionTooltip.php:144 msgid "Followers" msgstr "" -#: src/BaseModule.php:437 src/Content/Widget.php:236 src/Module/Contact.php:379 +#: src/BaseModule.php:437 src/Content/Widget.php:236 src/Module/Contact.php:396 msgid "Following" msgstr "" -#: src/BaseModule.php:442 src/Content/Widget.php:237 src/Module/Contact.php:380 +#: src/BaseModule.php:442 src/Content/Widget.php:237 src/Module/Contact.php:397 msgid "Mutual friends" msgstr "" @@ -1536,59 +1536,64 @@ msgstr "" msgid "%1$s tagged %2$s's %3$s with %4$s" msgstr "" -#: src/Content/Item.php:418 view/theme/frio/theme.php:269 +#: src/Content/Item.php:419 view/theme/frio/theme.php:269 msgid "Follow Thread" msgstr "" -#: src/Content/Item.php:419 src/Model/Contact.php:1205 +#: src/Content/Item.php:420 src/Model/Contact.php:1205 msgid "View Status" msgstr "" -#: src/Content/Item.php:420 src/Content/Item.php:438 src/Model/Contact.php:1149 +#: src/Content/Item.php:421 src/Content/Item.php:440 src/Model/Contact.php:1149 #: src/Model/Contact.php:1197 src/Model/Contact.php:1206 #: src/Module/Directory.php:157 src/Module/Settings/Profile/Index.php:234 msgid "View Profile" msgstr "" -#: src/Content/Item.php:421 src/Model/Contact.php:1207 +#: src/Content/Item.php:422 src/Model/Contact.php:1207 msgid "View Photos" msgstr "" -#: src/Content/Item.php:422 src/Model/Contact.php:1198 +#: src/Content/Item.php:423 src/Model/Contact.php:1198 #: src/Model/Contact.php:1208 msgid "Network Posts" msgstr "" -#: src/Content/Item.php:423 src/Model/Contact.php:1199 +#: src/Content/Item.php:424 src/Model/Contact.php:1199 #: src/Model/Contact.php:1209 msgid "View Contact" msgstr "" -#: src/Content/Item.php:424 src/Model/Contact.php:1210 +#: src/Content/Item.php:425 src/Model/Contact.php:1210 msgid "Send PM" msgstr "" -#: src/Content/Item.php:425 src/Module/Contact.php:409 -#: src/Module/Contact/Profile.php:348 src/Module/Contact/Profile.php:467 +#: src/Content/Item.php:426 src/Module/Contact.php:426 +#: src/Module/Contact/Profile.php:364 src/Module/Contact/Profile.php:484 #: src/Module/Moderation/Blocklist/Contact.php:116 #: src/Module/Moderation/Users/Active.php:137 #: src/Module/Moderation/Users/Index.php:152 msgid "Block" msgstr "" -#: src/Content/Item.php:426 src/Module/Contact.php:410 -#: src/Module/Contact/Profile.php:349 src/Module/Contact/Profile.php:475 +#: src/Content/Item.php:427 src/Module/Contact.php:427 +#: src/Module/Contact/Profile.php:365 src/Module/Contact/Profile.php:492 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Notification.php:89 msgid "Ignore" msgstr "" -#: src/Content/Item.php:430 src/Object/Post.php:454 +#: src/Content/Item.php:428 src/Module/Contact.php:428 +#: src/Module/Contact/Profile.php:500 +msgid "Collapse" +msgstr "" + +#: src/Content/Item.php:432 src/Object/Post.php:454 msgid "Languages" msgstr "" -#: src/Content/Item.php:435 src/Content/Widget.php:80 +#: src/Content/Item.php:437 src/Content/Widget.php:80 #: src/Model/Contact.php:1200 src/Model/Contact.php:1211 #: src/Module/Contact/Follow.php:166 view/theme/vier/theme.php:196 msgid "Connect/Follow" @@ -1628,7 +1633,7 @@ msgid "Sign in" msgstr "" #: src/Content/Nav.php:193 src/Module/BaseProfile.php:57 -#: src/Module/Contact.php:444 src/Module/Contact/Profile.php:380 +#: src/Module/Contact.php:462 src/Module/Contact/Profile.php:397 #: src/Module/Settings/TwoFactor/Index.php:119 view/theme/frio/theme.php:236 msgid "Status" msgstr "" @@ -1639,8 +1644,8 @@ msgid "Your posts and conversations" msgstr "" #: src/Content/Nav.php:194 src/Module/BaseProfile.php:49 -#: src/Module/BaseSettings.php:100 src/Module/Contact.php:468 -#: src/Module/Contact/Profile.php:382 src/Module/Profile/Profile.php:268 +#: src/Module/BaseSettings.php:100 src/Module/Contact.php:486 +#: src/Module/Contact/Profile.php:399 src/Module/Profile/Profile.php:268 #: src/Module/Welcome.php:57 view/theme/frio/theme.php:237 msgid "Profile" msgstr "" @@ -1659,7 +1664,7 @@ msgid "Your photos" msgstr "" #: src/Content/Nav.php:196 src/Module/BaseProfile.php:73 -#: src/Module/BaseProfile.php:76 src/Module/Contact.php:460 +#: src/Module/BaseProfile.php:76 src/Module/Contact.php:478 #: view/theme/frio/theme.php:242 msgid "Media" msgstr "" @@ -1745,8 +1750,8 @@ msgstr "" #: src/Content/Nav.php:238 src/Content/Nav.php:293 #: src/Content/Text/HTML.php:900 src/Module/BaseProfile.php:127 -#: src/Module/BaseProfile.php:130 src/Module/Contact.php:381 -#: src/Module/Contact.php:475 view/theme/frio/theme.php:250 +#: src/Module/BaseProfile.php:130 src/Module/Contact.php:398 +#: src/Module/Contact.php:493 view/theme/frio/theme.php:250 msgid "Contacts" msgstr "" @@ -1921,8 +1926,8 @@ msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3558 -#: src/Model/Item.php:3564 src/Model/Item.php:3565 +#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3561 +#: src/Model/Item.php:3567 src/Model/Item.php:3568 msgid "Link to source" msgstr "" @@ -1955,7 +1960,7 @@ msgid "The end" msgstr "" #: src/Content/Text/HTML.php:883 src/Content/Widget/VCard.php:109 -#: src/Model/Profile.php:463 src/Module/Contact/Profile.php:427 +#: src/Model/Profile.php:463 src/Module/Contact/Profile.php:444 msgid "Follow" msgstr "" @@ -1994,7 +1999,7 @@ msgstr "" msgid "Examples: Robert Morgenstein, Fishing" msgstr "" -#: src/Content/Widget.php:82 src/Module/Contact.php:402 +#: src/Content/Widget.php:82 src/Module/Contact.php:419 #: src/Module/Directory.php:96 view/theme/vier/theme.php:198 msgid "Find" msgstr "" @@ -2026,7 +2031,7 @@ msgid "Local Directory" msgstr "" #: src/Content/Widget.php:211 src/Model/Group.php:587 -#: src/Module/Contact.php:365 src/Module/Welcome.php:76 +#: src/Module/Contact.php:382 src/Module/Welcome.php:76 msgid "Groups" msgstr "" @@ -2038,7 +2043,7 @@ msgstr "" msgid "Relationships" msgstr "" -#: src/Content/Widget.php:244 src/Module/Contact.php:317 +#: src/Content/Widget.php:244 src/Module/Contact.php:334 #: src/Module/Group.php:291 msgid "All Contacts" msgstr "" @@ -2141,18 +2146,18 @@ msgid "More Trending Tags" msgstr "" #: src/Content/Widget/VCard.php:102 src/Model/Profile.php:378 -#: src/Module/Contact/Profile.php:371 src/Module/Profile/Profile.php:199 +#: src/Module/Contact/Profile.php:388 src/Module/Profile/Profile.php:199 msgid "XMPP:" msgstr "" #: src/Content/Widget/VCard.php:103 src/Model/Profile.php:379 -#: src/Module/Contact/Profile.php:373 src/Module/Profile/Profile.php:203 +#: src/Module/Contact/Profile.php:390 src/Module/Profile/Profile.php:203 msgid "Matrix:" msgstr "" #: src/Content/Widget/VCard.php:104 src/Model/Event.php:82 #: src/Model/Event.php:109 src/Model/Event.php:473 src/Model/Event.php:958 -#: src/Model/Profile.php:373 src/Module/Contact/Profile.php:369 +#: src/Model/Profile.php:373 src/Module/Contact/Profile.php:386 #: src/Module/Directory.php:147 src/Module/Notifications/Introductions.php:187 #: src/Module/Profile/Profile.php:221 msgid "Location:" @@ -2165,7 +2170,7 @@ msgstr "" #: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1201 #: src/Model/Contact.php:1212 src/Model/Profile.php:465 -#: src/Module/Contact/Profile.php:419 +#: src/Module/Contact/Profile.php:436 msgid "Unfollow" msgstr "" @@ -3110,47 +3115,52 @@ msgstr "" #: src/Model/Item.php:3052 #, php-format +msgid "Content from %s is collapsed" +msgstr "" + +#: src/Model/Item.php:3055 +#, php-format msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3470 +#: src/Model/Item.php:3473 msgid "bytes" msgstr "" -#: src/Model/Item.php:3501 +#: src/Model/Item.php:3504 #, 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:3503 +#: src/Model/Item.php:3506 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3508 +#: src/Model/Item.php:3511 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3510 +#: src/Model/Item.php:3513 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3512 +#: src/Model/Item.php:3515 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3546 src/Model/Item.php:3547 +#: src/Model/Item.php:3549 src/Model/Item.php:3550 msgid "View on separate page" msgstr "" @@ -3176,7 +3186,7 @@ msgstr "" msgid "Homepage:" msgstr "" -#: src/Model/Profile.php:377 src/Module/Contact/Profile.php:375 +#: src/Model/Profile.php:377 src/Module/Contact/Profile.php:392 #: src/Module/Notifications/Introductions.php:189 msgid "About:" msgstr "" @@ -4094,7 +4104,7 @@ msgid "Policies" msgstr "" #: src/Module/Admin/Site.php:443 src/Module/Calendar/Event/Form.php:252 -#: src/Module/Contact.php:485 src/Module/Profile/Profile.php:276 +#: src/Module/Contact.php:503 src/Module/Profile/Profile.php:276 msgid "Advanced" msgstr "" @@ -4888,7 +4898,7 @@ msgid "" "received." msgstr "" -#: src/Module/Admin/Site.php:551 src/Module/Contact/Profile.php:274 +#: src/Module/Admin/Site.php:551 src/Module/Contact/Profile.php:290 #: src/Module/Settings/TwoFactor/Index.php:125 msgid "Disabled" msgstr "" @@ -5401,11 +5411,11 @@ msgstr "" msgid "Item Source" msgstr "" -#: src/Module/BaseProfile.php:52 src/Module/Contact.php:471 +#: src/Module/BaseProfile.php:52 src/Module/Contact.php:489 msgid "Profile Details" msgstr "" -#: src/Module/BaseProfile.php:60 src/Module/Contact.php:455 +#: src/Module/BaseProfile.php:60 src/Module/Contact.php:473 #: src/Module/Contact/Follow.php:191 src/Module/Contact/Unfollow.php:138 msgid "Status Messages and Posts" msgstr "" @@ -5593,135 +5603,139 @@ msgstr "" msgid "list" msgstr "" -#: src/Module/Contact.php:92 +#: src/Module/Contact.php:97 #, php-format msgid "%d contact edited." msgid_plural "%d contacts edited." msgstr[0] "" msgstr[1] "" -#: src/Module/Contact.php:320 +#: src/Module/Contact.php:337 msgid "Show all contacts" msgstr "" -#: src/Module/Contact.php:325 src/Module/Contact.php:385 +#: src/Module/Contact.php:342 src/Module/Contact.php:402 #: src/Module/Moderation/BaseUsers.php:85 msgid "Pending" msgstr "" -#: src/Module/Contact.php:328 +#: src/Module/Contact.php:345 msgid "Only show pending contacts" msgstr "" -#: src/Module/Contact.php:333 src/Module/Contact.php:386 +#: src/Module/Contact.php:350 src/Module/Contact.php:403 #: src/Module/Moderation/BaseUsers.php:93 msgid "Blocked" msgstr "" -#: src/Module/Contact.php:336 +#: src/Module/Contact.php:353 msgid "Only show blocked contacts" msgstr "" -#: src/Module/Contact.php:341 src/Module/Contact.php:388 +#: src/Module/Contact.php:358 src/Module/Contact.php:405 #: src/Object/Post.php:338 msgid "Ignored" msgstr "" -#: src/Module/Contact.php:344 +#: src/Module/Contact.php:361 msgid "Only show ignored contacts" msgstr "" -#: src/Module/Contact.php:349 src/Module/Contact.php:389 +#: src/Module/Contact.php:366 src/Module/Contact.php:406 msgid "Archived" msgstr "" -#: src/Module/Contact.php:352 +#: src/Module/Contact.php:369 msgid "Only show archived contacts" msgstr "" -#: src/Module/Contact.php:357 src/Module/Contact.php:387 +#: src/Module/Contact.php:374 src/Module/Contact.php:404 msgid "Hidden" msgstr "" -#: src/Module/Contact.php:360 +#: src/Module/Contact.php:377 msgid "Only show hidden contacts" msgstr "" -#: src/Module/Contact.php:368 +#: src/Module/Contact.php:385 msgid "Organize your contact groups" msgstr "" -#: src/Module/Contact.php:400 +#: src/Module/Contact.php:417 msgid "Search your contacts" msgstr "" -#: src/Module/Contact.php:401 src/Module/Search/Index.php:206 +#: src/Module/Contact.php:418 src/Module/Search/Index.php:206 #, php-format msgid "Results for: %s" msgstr "" -#: src/Module/Contact.php:408 +#: src/Module/Contact.php:425 msgid "Update" msgstr "" -#: src/Module/Contact.php:409 src/Module/Contact/Profile.php:348 -#: src/Module/Contact/Profile.php:467 +#: src/Module/Contact.php:426 src/Module/Contact/Profile.php:364 +#: src/Module/Contact/Profile.php:484 #: src/Module/Moderation/Blocklist/Contact.php:117 #: src/Module/Moderation/Users/Blocked.php:138 #: src/Module/Moderation/Users/Index.php:154 msgid "Unblock" msgstr "" -#: src/Module/Contact.php:410 src/Module/Contact/Profile.php:349 -#: src/Module/Contact/Profile.php:475 +#: src/Module/Contact.php:427 src/Module/Contact/Profile.php:365 +#: src/Module/Contact/Profile.php:492 msgid "Unignore" msgstr "" -#: src/Module/Contact.php:412 +#: src/Module/Contact.php:428 src/Module/Contact/Profile.php:500 +msgid "Uncollapse" +msgstr "" + +#: src/Module/Contact.php:430 msgid "Batch Actions" msgstr "" -#: src/Module/Contact.php:447 +#: src/Module/Contact.php:465 msgid "Conversations started by this contact" msgstr "" -#: src/Module/Contact.php:452 +#: src/Module/Contact.php:470 msgid "Posts and Comments" msgstr "" -#: src/Module/Contact.php:463 +#: src/Module/Contact.php:481 msgid "Posts containing media objects" msgstr "" -#: src/Module/Contact.php:478 +#: src/Module/Contact.php:496 msgid "View all known contacts" msgstr "" -#: src/Module/Contact.php:488 +#: src/Module/Contact.php:506 msgid "Advanced Contact Settings" msgstr "" -#: src/Module/Contact.php:524 +#: src/Module/Contact.php:542 msgid "Mutual Friendship" msgstr "" -#: src/Module/Contact.php:528 +#: src/Module/Contact.php:546 msgid "is a fan of yours" msgstr "" -#: src/Module/Contact.php:532 +#: src/Module/Contact.php:550 msgid "you are a fan of" msgstr "" -#: src/Module/Contact.php:550 +#: src/Module/Contact.php:568 msgid "Pending outgoing contact request" msgstr "" -#: src/Module/Contact.php:552 +#: src/Module/Contact.php:570 msgid "Pending incoming contact request" msgstr "" -#: src/Module/Contact.php:565 src/Module/Contact/Profile.php:334 +#: src/Module/Contact.php:583 src/Module/Contact/Profile.php:350 #, php-format msgid "Visit %s's profile [%s]" msgstr "" @@ -5874,7 +5888,7 @@ msgstr "" msgid "Your Identity Address:" msgstr "" -#: src/Module/Contact/Follow.php:169 src/Module/Contact/Profile.php:365 +#: src/Module/Contact/Follow.php:169 src/Module/Contact/Profile.php:382 #: src/Module/Contact/Unfollow.php:129 #: src/Module/Moderation/Blocklist/Contact.php:133 #: src/Module/Notifications/Introductions.php:129 @@ -5882,7 +5896,7 @@ msgstr "" msgid "Profile URL" msgstr "" -#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:377 +#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:394 #: src/Module/Notifications/Introductions.php:191 #: src/Module/Profile/Profile.php:234 msgid "Tags:" @@ -5937,207 +5951,219 @@ msgstr "" msgid "Contact has been ignored" msgstr "" -#: src/Module/Contact/Profile.php:230 +#: src/Module/Contact/Profile.php:210 src/Module/Contact/Profile.php:214 +msgid "Contact has been collapsed" +msgstr "" + +#: src/Module/Contact/Profile.php:246 #, php-format msgid "You are mutual friends with %s" msgstr "" -#: src/Module/Contact/Profile.php:231 +#: src/Module/Contact/Profile.php:247 #, php-format msgid "You are sharing with %s" msgstr "" -#: src/Module/Contact/Profile.php:232 +#: src/Module/Contact/Profile.php:248 #, php-format msgid "%s is sharing with you" msgstr "" -#: src/Module/Contact/Profile.php:248 +#: src/Module/Contact/Profile.php:264 msgid "Private communications are not available for this contact." msgstr "" -#: src/Module/Contact/Profile.php:250 +#: src/Module/Contact/Profile.php:266 msgid "Never" msgstr "" -#: src/Module/Contact/Profile.php:253 +#: src/Module/Contact/Profile.php:269 msgid "(Update was not successful)" msgstr "" -#: src/Module/Contact/Profile.php:253 +#: src/Module/Contact/Profile.php:269 msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:438 +#: src/Module/Contact/Profile.php:271 src/Module/Contact/Profile.php:455 msgid "Suggest friends" msgstr "" -#: src/Module/Contact/Profile.php:259 +#: src/Module/Contact/Profile.php:275 #, php-format msgid "Network type: %s" msgstr "" -#: src/Module/Contact/Profile.php:264 +#: src/Module/Contact/Profile.php:280 msgid "Communications lost with this contact!" msgstr "" -#: src/Module/Contact/Profile.php:270 +#: src/Module/Contact/Profile.php:286 msgid "Fetch further information for feeds" msgstr "" -#: src/Module/Contact/Profile.php:272 +#: src/Module/Contact/Profile.php:288 msgid "" "Fetch information like preview pictures, title and teaser from the feed " "item. You can activate this if the feed doesn't contain much text. Keywords " "are taken from the meta header in the feed item and are posted as hash tags." msgstr "" -#: src/Module/Contact/Profile.php:275 +#: src/Module/Contact/Profile.php:291 msgid "Fetch information" msgstr "" -#: src/Module/Contact/Profile.php:276 +#: src/Module/Contact/Profile.php:292 msgid "Fetch keywords" msgstr "" -#: src/Module/Contact/Profile.php:277 +#: src/Module/Contact/Profile.php:293 msgid "Fetch information and keywords" msgstr "" -#: src/Module/Contact/Profile.php:287 src/Module/Contact/Profile.php:292 -#: src/Module/Contact/Profile.php:297 src/Module/Contact/Profile.php:303 +#: src/Module/Contact/Profile.php:303 src/Module/Contact/Profile.php:308 +#: src/Module/Contact/Profile.php:313 src/Module/Contact/Profile.php:319 msgid "No mirroring" msgstr "" -#: src/Module/Contact/Profile.php:288 src/Module/Contact/Profile.php:298 -#: src/Module/Contact/Profile.php:304 +#: src/Module/Contact/Profile.php:304 src/Module/Contact/Profile.php:314 +#: src/Module/Contact/Profile.php:320 msgid "Mirror as my own posting" msgstr "" -#: src/Module/Contact/Profile.php:293 src/Module/Contact/Profile.php:299 +#: src/Module/Contact/Profile.php:309 src/Module/Contact/Profile.php:315 msgid "Native reshare" msgstr "" -#: src/Module/Contact/Profile.php:316 +#: src/Module/Contact/Profile.php:332 msgid "Contact Information / Notes" msgstr "" -#: src/Module/Contact/Profile.php:317 +#: src/Module/Contact/Profile.php:333 msgid "Contact Settings" msgstr "" -#: src/Module/Contact/Profile.php:325 +#: src/Module/Contact/Profile.php:341 msgid "Contact" msgstr "" -#: src/Module/Contact/Profile.php:329 +#: src/Module/Contact/Profile.php:345 msgid "Their personal note" msgstr "" -#: src/Module/Contact/Profile.php:331 +#: src/Module/Contact/Profile.php:347 msgid "Edit contact notes" msgstr "" -#: src/Module/Contact/Profile.php:335 +#: src/Module/Contact/Profile.php:351 msgid "Block/Unblock contact" msgstr "" -#: src/Module/Contact/Profile.php:336 +#: src/Module/Contact/Profile.php:352 msgid "Ignore contact" msgstr "" -#: src/Module/Contact/Profile.php:337 +#: src/Module/Contact/Profile.php:353 msgid "View conversations" msgstr "" -#: src/Module/Contact/Profile.php:342 +#: src/Module/Contact/Profile.php:358 msgid "Last update:" msgstr "" -#: src/Module/Contact/Profile.php:344 +#: src/Module/Contact/Profile.php:360 msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:346 src/Module/Contact/Profile.php:448 +#: src/Module/Contact/Profile.php:362 src/Module/Contact/Profile.php:465 msgid "Update now" msgstr "" -#: src/Module/Contact/Profile.php:353 +#: src/Module/Contact/Profile.php:369 msgid "Currently blocked" msgstr "" -#: src/Module/Contact/Profile.php:354 +#: src/Module/Contact/Profile.php:370 msgid "Currently ignored" msgstr "" -#: src/Module/Contact/Profile.php:355 +#: src/Module/Contact/Profile.php:371 +msgid "Currently collapsed" +msgstr "" + +#: src/Module/Contact/Profile.php:372 msgid "Currently archived" msgstr "" -#: src/Module/Contact/Profile.php:356 +#: src/Module/Contact/Profile.php:373 msgid "Awaiting connection acknowledge" msgstr "" -#: src/Module/Contact/Profile.php:357 +#: src/Module/Contact/Profile.php:374 #: src/Module/Notifications/Introductions.php:192 msgid "Hide this contact from others" msgstr "" -#: src/Module/Contact/Profile.php:357 +#: src/Module/Contact/Profile.php:374 msgid "" "Replies/likes to your public posts may still be visible" msgstr "" -#: src/Module/Contact/Profile.php:358 +#: src/Module/Contact/Profile.php:375 msgid "Notification for new posts" msgstr "" -#: src/Module/Contact/Profile.php:358 +#: src/Module/Contact/Profile.php:375 msgid "Send a notification of every new post of this contact" msgstr "" -#: src/Module/Contact/Profile.php:360 +#: src/Module/Contact/Profile.php:377 msgid "Keyword Deny List" msgstr "" -#: src/Module/Contact/Profile.php:360 +#: src/Module/Contact/Profile.php:377 msgid "" "Comma separated list of keywords that should not be converted to hashtags, " "when \"Fetch information and keywords\" is selected" msgstr "" -#: src/Module/Contact/Profile.php:378 +#: src/Module/Contact/Profile.php:395 #: src/Module/Settings/TwoFactor/Index.php:139 msgid "Actions" msgstr "" -#: src/Module/Contact/Profile.php:386 +#: src/Module/Contact/Profile.php:403 msgid "Mirror postings from this contact" msgstr "" -#: src/Module/Contact/Profile.php:388 +#: src/Module/Contact/Profile.php:405 msgid "" "Mark this contact as remote_self, this will cause friendica to repost new " "entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:458 +#: src/Module/Contact/Profile.php:475 msgid "Refetch contact data" msgstr "" -#: src/Module/Contact/Profile.php:469 +#: src/Module/Contact/Profile.php:486 msgid "Toggle Blocked status" msgstr "" -#: src/Module/Contact/Profile.php:477 +#: src/Module/Contact/Profile.php:494 msgid "Toggle Ignored status" msgstr "" -#: src/Module/Contact/Profile.php:484 src/Module/Contact/Revoke.php:106 +#: src/Module/Contact/Profile.php:502 +msgid "Toggle Collapsed status" +msgstr "" + +#: src/Module/Contact/Profile.php:509 src/Module/Contact/Revoke.php:106 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:486 +#: src/Module/Contact/Profile.php:511 msgid "Revoke the follow from this contact" msgstr "" @@ -8136,17 +8162,17 @@ msgstr "" msgid "The Photo is not available." msgstr "" -#: src/Module/Photo.php:142 +#: src/Module/Photo.php:154 #, php-format msgid "The Photo with id %s is not available." msgstr "" -#: src/Module/Photo.php:179 +#: src/Module/Photo.php:191 #, php-format msgid "Invalid external resource with url %s." msgstr "" -#: src/Module/Photo.php:181 +#: src/Module/Photo.php:193 #, php-format msgid "Invalid photo with id %s." msgstr "" diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index 2b84657c8..97f7a6526 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -23,6 +23,7 @@
  • {{$contact_actions.block.label}}
  • {{$contact_actions.ignore.label}}
  • +
  • {{$contact_actions.collapse.label}}
  • {{if $contact_actions.revoke_follow.url}}
  • {{$contact_actions.revoke_follow.label}}
  • {{/if}} @@ -44,6 +45,7 @@ {{if $blocked && !$pending}}
  • {{$blocked}}
  • {{/if}} {{if $pending}}
  • {{$pending}}
  • {{/if}} {{if $ignored}}
  • {{$ignored}}
  • {{/if}} + {{if $collapsed}}
  • {{$collapsed}}
  • {{/if}} {{if $archived}}
  • {{$archived}}
  • {{/if}} {{* End of contact-edit-status-wrapper *}} diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index 693434cc8..cb26e52dc 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -29,6 +29,7 @@ {{/if}}
  • {{$contact_actions.block.label}}
  • {{$contact_actions.ignore.label}}
  • +
  • {{$contact_actions.collapse.label}}
  • {{if $contact_actions.revoke_follow.url}}
  • {{/if}} @@ -58,6 +59,7 @@ {{if $blocked && !$pending}}
  • {{$blocked}}
  • {{/if}} {{if $pending}}
  • {{$pending}}
  • {{/if}} {{if $ignored}}
  • {{$ignored}}
  • {{/if}} + {{if $collapsed}}
  • {{$collapsed}}
  • {{/if}} {{if $archived}}
  • {{$archived}}
  • {{/if}} {{* End of contact-edit-status-wrapper *}} From 480d9f53c3a224ce2df7b9cf4a2043583c608d2e Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 18:28:19 +0000 Subject: [PATCH 2/8] Added "collapsed" list --- src/Module/Contact.php | 24 +++++++++++++++++++----- static/routes.config.php | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 23a2e9c49..7441e52bc 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -247,6 +247,11 @@ class Contact extends BaseModule // This makes the query look for contact.uid = 0 array_unshift($sql_values, 0); break; + case 'collapsed': + $sql_extra = " AND `id` IN (SELECT `cid` FROM `user-contact` WHERE `user-contact`.`uid` = ? AND `user-contact`.`collapsed`)"; + // This makes the query look for contact.uid = 0 + array_unshift($sql_values, 0); + break; case 'archived': $sql_extra = " AND `archive` AND NOT `blocked` AND NOT `pending`"; break; @@ -362,6 +367,14 @@ class Contact extends BaseModule 'id' => 'showignored-tab', 'accesskey' => 'i', ], + [ + 'label' => DI::l10n()->t('Collapsed'), + 'url' => 'contact/collapsed', + 'sel' => $type == 'collapsed' ? 'active' : '', + 'title' => DI::l10n()->t('Only show collapsed contacts'), + 'id' => 'showcollapsed-tab', + 'accesskey' => 'c', + ], [ 'label' => DI::l10n()->t('Archived'), 'url' => 'contact/archived', @@ -399,11 +412,12 @@ class Contact extends BaseModule } switch ($type) { - case 'pending': $header .= ' - ' . DI::l10n()->t('Pending'); break; - case 'blocked': $header .= ' - ' . DI::l10n()->t('Blocked'); break; - case 'hidden': $header .= ' - ' . DI::l10n()->t('Hidden'); break; - case 'ignored': $header .= ' - ' . DI::l10n()->t('Ignored'); break; - case 'archived': $header .= ' - ' . DI::l10n()->t('Archived'); break; + case 'pending': $header .= ' - ' . DI::l10n()->t('Pending'); break; + case 'blocked': $header .= ' - ' . DI::l10n()->t('Blocked'); break; + case 'hidden': $header .= ' - ' . DI::l10n()->t('Hidden'); break; + case 'ignored': $header .= ' - ' . DI::l10n()->t('Ignored'); break; + case 'collapsed': $header .= ' - ' . DI::l10n()->t('collapsed'); break; + case 'archived': $header .= ' - ' . DI::l10n()->t('Archived'); break; } $header .= $nets ? ' - ' . ContactSelector::networkToName($nets) : ''; diff --git a/static/routes.config.php b/static/routes.config.php index 51030c6a7..bc10fdac0 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -401,6 +401,7 @@ return [ '/hidden' => [Module\Contact::class, [R::GET]], '/hovercard' => [Module\Contact\Hovercard::class, [R::GET]], '/ignored' => [Module\Contact::class, [R::GET]], + '/collapsed' => [Module\Contact::class, [R::GET]], '/match' => [Module\Contact\MatchInterests::class, [R::GET]], '/pending' => [Module\Contact::class, [R::GET]], '/redir/{id:\d+}' => [Module\Contact\Redir::class, [R::GET]], From 5738d480da859a5495e7ca8755bfc31c7685896d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 18:28:34 +0000 Subject: [PATCH 3/8] Changed messages.po --- view/lang/C/messages.po | 110 ++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 49 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 41c14c614..793cabc9b 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-08 17:47+0000\n" +"POT-Creation-Date: 2023-01-08 18:27+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -596,7 +596,7 @@ msgid "Rotate CCW (left)" msgstr "" #: mod/photos.php:1141 mod/photos.php:1197 mod/photos.php:1271 -#: src/Module/Contact.php:575 src/Module/Item/Compose.php:188 +#: src/Module/Contact.php:589 src/Module/Item/Compose.php:188 #: src/Object/Post.php:983 msgid "This is you" msgstr "" @@ -696,16 +696,16 @@ msgid "All contacts" msgstr "" #: src/BaseModule.php:432 src/Content/Widget.php:235 src/Core/ACL.php:194 -#: src/Module/Contact.php:395 src/Module/PermissionTooltip.php:122 +#: src/Module/Contact.php:408 src/Module/PermissionTooltip.php:122 #: src/Module/PermissionTooltip.php:144 msgid "Followers" msgstr "" -#: src/BaseModule.php:437 src/Content/Widget.php:236 src/Module/Contact.php:396 +#: src/BaseModule.php:437 src/Content/Widget.php:236 src/Module/Contact.php:409 msgid "Following" msgstr "" -#: src/BaseModule.php:442 src/Content/Widget.php:237 src/Module/Contact.php:397 +#: src/BaseModule.php:442 src/Content/Widget.php:237 src/Module/Contact.php:410 msgid "Mutual friends" msgstr "" @@ -1568,7 +1568,7 @@ msgstr "" msgid "Send PM" msgstr "" -#: src/Content/Item.php:426 src/Module/Contact.php:426 +#: src/Content/Item.php:426 src/Module/Contact.php:440 #: src/Module/Contact/Profile.php:364 src/Module/Contact/Profile.php:484 #: src/Module/Moderation/Blocklist/Contact.php:116 #: src/Module/Moderation/Users/Active.php:137 @@ -1576,7 +1576,7 @@ msgstr "" msgid "Block" msgstr "" -#: src/Content/Item.php:427 src/Module/Contact.php:427 +#: src/Content/Item.php:427 src/Module/Contact.php:441 #: src/Module/Contact/Profile.php:365 src/Module/Contact/Profile.php:492 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 @@ -1584,7 +1584,7 @@ msgstr "" msgid "Ignore" msgstr "" -#: src/Content/Item.php:428 src/Module/Contact.php:428 +#: src/Content/Item.php:428 src/Module/Contact.php:442 #: src/Module/Contact/Profile.php:500 msgid "Collapse" msgstr "" @@ -1633,7 +1633,7 @@ msgid "Sign in" msgstr "" #: src/Content/Nav.php:193 src/Module/BaseProfile.php:57 -#: src/Module/Contact.php:462 src/Module/Contact/Profile.php:397 +#: src/Module/Contact.php:476 src/Module/Contact/Profile.php:397 #: src/Module/Settings/TwoFactor/Index.php:119 view/theme/frio/theme.php:236 msgid "Status" msgstr "" @@ -1644,7 +1644,7 @@ msgid "Your posts and conversations" msgstr "" #: src/Content/Nav.php:194 src/Module/BaseProfile.php:49 -#: src/Module/BaseSettings.php:100 src/Module/Contact.php:486 +#: src/Module/BaseSettings.php:100 src/Module/Contact.php:500 #: src/Module/Contact/Profile.php:399 src/Module/Profile/Profile.php:268 #: src/Module/Welcome.php:57 view/theme/frio/theme.php:237 msgid "Profile" @@ -1664,7 +1664,7 @@ msgid "Your photos" msgstr "" #: src/Content/Nav.php:196 src/Module/BaseProfile.php:73 -#: src/Module/BaseProfile.php:76 src/Module/Contact.php:478 +#: src/Module/BaseProfile.php:76 src/Module/Contact.php:492 #: view/theme/frio/theme.php:242 msgid "Media" msgstr "" @@ -1750,8 +1750,8 @@ msgstr "" #: src/Content/Nav.php:238 src/Content/Nav.php:293 #: src/Content/Text/HTML.php:900 src/Module/BaseProfile.php:127 -#: src/Module/BaseProfile.php:130 src/Module/Contact.php:398 -#: src/Module/Contact.php:493 view/theme/frio/theme.php:250 +#: src/Module/BaseProfile.php:130 src/Module/Contact.php:411 +#: src/Module/Contact.php:507 view/theme/frio/theme.php:250 msgid "Contacts" msgstr "" @@ -1999,7 +1999,7 @@ msgstr "" msgid "Examples: Robert Morgenstein, Fishing" msgstr "" -#: src/Content/Widget.php:82 src/Module/Contact.php:419 +#: src/Content/Widget.php:82 src/Module/Contact.php:433 #: src/Module/Directory.php:96 view/theme/vier/theme.php:198 msgid "Find" msgstr "" @@ -2031,7 +2031,7 @@ msgid "Local Directory" msgstr "" #: src/Content/Widget.php:211 src/Model/Group.php:587 -#: src/Module/Contact.php:382 src/Module/Welcome.php:76 +#: src/Module/Contact.php:395 src/Module/Welcome.php:76 msgid "Groups" msgstr "" @@ -2043,7 +2043,7 @@ msgstr "" msgid "Relationships" msgstr "" -#: src/Content/Widget.php:244 src/Module/Contact.php:334 +#: src/Content/Widget.php:244 src/Module/Contact.php:339 #: src/Module/Group.php:291 msgid "All Contacts" msgstr "" @@ -4104,7 +4104,7 @@ msgid "Policies" msgstr "" #: src/Module/Admin/Site.php:443 src/Module/Calendar/Event/Form.php:252 -#: src/Module/Contact.php:503 src/Module/Profile/Profile.php:276 +#: src/Module/Contact.php:517 src/Module/Profile/Profile.php:276 msgid "Advanced" msgstr "" @@ -5406,11 +5406,11 @@ msgstr "" msgid "Item Source" msgstr "" -#: src/Module/BaseProfile.php:52 src/Module/Contact.php:489 +#: src/Module/BaseProfile.php:52 src/Module/Contact.php:503 msgid "Profile Details" msgstr "" -#: src/Module/BaseProfile.php:60 src/Module/Contact.php:473 +#: src/Module/BaseProfile.php:60 src/Module/Contact.php:487 #: src/Module/Contact/Follow.php:191 src/Module/Contact/Unfollow.php:138 msgid "Status Messages and Posts" msgstr "" @@ -5605,71 +5605,83 @@ msgid_plural "%d contacts edited." msgstr[0] "" msgstr[1] "" -#: src/Module/Contact.php:337 +#: src/Module/Contact.php:342 msgid "Show all contacts" msgstr "" -#: src/Module/Contact.php:342 src/Module/Contact.php:402 +#: src/Module/Contact.php:347 src/Module/Contact.php:415 #: src/Module/Moderation/BaseUsers.php:85 msgid "Pending" msgstr "" -#: src/Module/Contact.php:345 +#: src/Module/Contact.php:350 msgid "Only show pending contacts" msgstr "" -#: src/Module/Contact.php:350 src/Module/Contact.php:403 +#: src/Module/Contact.php:355 src/Module/Contact.php:416 #: src/Module/Moderation/BaseUsers.php:93 msgid "Blocked" msgstr "" -#: src/Module/Contact.php:353 +#: src/Module/Contact.php:358 msgid "Only show blocked contacts" msgstr "" -#: src/Module/Contact.php:358 src/Module/Contact.php:405 +#: src/Module/Contact.php:363 src/Module/Contact.php:418 #: src/Object/Post.php:338 msgid "Ignored" msgstr "" -#: src/Module/Contact.php:361 +#: src/Module/Contact.php:366 msgid "Only show ignored contacts" msgstr "" -#: src/Module/Contact.php:366 src/Module/Contact.php:406 +#: src/Module/Contact.php:371 +msgid "Collapsed" +msgstr "" + +#: src/Module/Contact.php:374 +msgid "Only show collapsed contacts" +msgstr "" + +#: src/Module/Contact.php:379 src/Module/Contact.php:420 msgid "Archived" msgstr "" -#: src/Module/Contact.php:369 +#: src/Module/Contact.php:382 msgid "Only show archived contacts" msgstr "" -#: src/Module/Contact.php:374 src/Module/Contact.php:404 +#: src/Module/Contact.php:387 src/Module/Contact.php:417 msgid "Hidden" msgstr "" -#: src/Module/Contact.php:377 +#: src/Module/Contact.php:390 msgid "Only show hidden contacts" msgstr "" -#: src/Module/Contact.php:385 +#: src/Module/Contact.php:398 msgid "Organize your contact groups" msgstr "" -#: src/Module/Contact.php:417 +#: src/Module/Contact.php:419 +msgid "collapsed" +msgstr "" + +#: src/Module/Contact.php:431 msgid "Search your contacts" msgstr "" -#: src/Module/Contact.php:418 src/Module/Search/Index.php:206 +#: src/Module/Contact.php:432 src/Module/Search/Index.php:206 #, php-format msgid "Results for: %s" msgstr "" -#: src/Module/Contact.php:425 +#: src/Module/Contact.php:439 msgid "Update" msgstr "" -#: src/Module/Contact.php:426 src/Module/Contact/Profile.php:364 +#: src/Module/Contact.php:440 src/Module/Contact/Profile.php:364 #: src/Module/Contact/Profile.php:484 #: src/Module/Moderation/Blocklist/Contact.php:117 #: src/Module/Moderation/Users/Blocked.php:138 @@ -5677,60 +5689,60 @@ msgstr "" msgid "Unblock" msgstr "" -#: src/Module/Contact.php:427 src/Module/Contact/Profile.php:365 +#: src/Module/Contact.php:441 src/Module/Contact/Profile.php:365 #: src/Module/Contact/Profile.php:492 msgid "Unignore" msgstr "" -#: src/Module/Contact.php:428 src/Module/Contact/Profile.php:500 +#: src/Module/Contact.php:442 src/Module/Contact/Profile.php:500 msgid "Uncollapse" msgstr "" -#: src/Module/Contact.php:430 +#: src/Module/Contact.php:444 msgid "Batch Actions" msgstr "" -#: src/Module/Contact.php:465 +#: src/Module/Contact.php:479 msgid "Conversations started by this contact" msgstr "" -#: src/Module/Contact.php:470 +#: src/Module/Contact.php:484 msgid "Posts and Comments" msgstr "" -#: src/Module/Contact.php:481 +#: src/Module/Contact.php:495 msgid "Posts containing media objects" msgstr "" -#: src/Module/Contact.php:496 +#: src/Module/Contact.php:510 msgid "View all known contacts" msgstr "" -#: src/Module/Contact.php:506 +#: src/Module/Contact.php:520 msgid "Advanced Contact Settings" msgstr "" -#: src/Module/Contact.php:542 +#: src/Module/Contact.php:556 msgid "Mutual Friendship" msgstr "" -#: src/Module/Contact.php:546 +#: src/Module/Contact.php:560 msgid "is a fan of yours" msgstr "" -#: src/Module/Contact.php:550 +#: src/Module/Contact.php:564 msgid "you are a fan of" msgstr "" -#: src/Module/Contact.php:568 +#: src/Module/Contact.php:582 msgid "Pending outgoing contact request" msgstr "" -#: src/Module/Contact.php:570 +#: src/Module/Contact.php:584 msgid "Pending incoming contact request" msgstr "" -#: src/Module/Contact.php:583 src/Module/Contact/Profile.php:350 +#: src/Module/Contact.php:597 src/Module/Contact/Profile.php:350 #, php-format msgid "Visit %s's profile [%s]" msgstr "" From b0aa4eb4b759668bf413a9198133ea362887ee99 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 18:59:07 +0000 Subject: [PATCH 4/8] Update routine to transfer the blockem list to collapsed --- database.sql | 2 +- static/dbstructure.config.php | 2 +- update.php | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/database.sql b/database.sql index 9ffa3544a..e06454b11 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1509 +-- DB_UPDATE_VERSION 1510 -- ------------------------------------------ diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 848da0404..d25d9cc3f 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1509); + define('DB_UPDATE_VERSION', 1510); } return [ diff --git a/update.php b/update.php index 0491e4a92..951f54a3b 100644 --- a/update.php +++ b/update.php @@ -1213,3 +1213,18 @@ function update_1509() return Update::SUCCESS; } + +function update_1510() +{ + $blocks = DBA::select('pconfig', ['uid', 'v'], ['cat' => 'blockem', 'k' => 'words']); + while ($block = DBA::fetch($blocks)) { + foreach (explode(',', $block['v']) as $account) { + $id = Contact::getIdForURL(trim($account), 0, false); + if (empty($id)) { + continue; + } + Contact\User::setCollapsed($id, $block['uid'], true); + } + } + return Update::SUCCESS; +} From c9b6da01277e1b82afb45c8d6f2d8137a5cfd201 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 19:01:12 +0000 Subject: [PATCH 5/8] Remoce test code --- update.php | 1 - 1 file changed, 1 deletion(-) diff --git a/update.php b/update.php index 951f54a3b..85a06892f 100644 --- a/update.php +++ b/update.php @@ -1202,7 +1202,6 @@ function update_1509() $newConfig = DI::config()->beginTransaction(); foreach ($addons as $addon) { - print_r($addon); $newConfig->set('addons', $addon['name'], [ 'last_update' => $addon['timestamp'], 'admin' => (bool)$addon['plugin_admin'], From c1f9c1aaa5ab7c273f2947b5419538aa03c44938 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 8 Jan 2023 23:13:31 +0100 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Model/Item.php | 1 + src/Module/Contact.php | 2 +- src/Module/Contact/Profile.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 8b1002fb2..afa51461e 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3051,6 +3051,7 @@ class Item if (Contact\User::isCollapsed($item['author-id'], $item['uid'])) { $filter_reasons[] = DI::l10n()->t('Content from %s is collapsed', $item['author-name']); } + if (!empty($item['content-warning']) && (!DI::userSession()->getLocalUserId() || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'disable_cw', false))) { $filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 7441e52bc..21b1793af 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -416,7 +416,7 @@ class Contact extends BaseModule case 'blocked': $header .= ' - ' . DI::l10n()->t('Blocked'); break; case 'hidden': $header .= ' - ' . DI::l10n()->t('Hidden'); break; case 'ignored': $header .= ' - ' . DI::l10n()->t('Ignored'); break; - case 'collapsed': $header .= ' - ' . DI::l10n()->t('collapsed'); break; + case 'collapsed': $header .= ' - ' . DI::l10n()->t('Collapsed'); break; case 'archived': $header .= ' - ' . DI::l10n()->t('Archived'); break; } diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 886798a5f..15eebd360 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -207,7 +207,7 @@ class Profile extends BaseModule // @TODO Backward compatibility, replace with $localRelationship->unblock() Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), false); - $message = $this->t('Contact has been collapsed'); + $message = $this->t('Contact has been uncollapsed'); } else { // @TODO Backward compatibility, replace with $localRelationship->block() Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), true); From 82b28e173bb9ef5fde06b7e5bdb54c8456aba6f2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 23:15:15 +0000 Subject: [PATCH 7/8] Updated mesages.po --- view/lang/C/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 793cabc9b..071fc7fc8 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-08 18:27+0000\n" +"POT-Creation-Date: 2023-01-08 23:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 83dd49a43c13dcb8daba70471c9be31d7b36d489 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 8 Jan 2023 23:26:26 +0000 Subject: [PATCH 8/8] Updated "messages.po" again --- view/lang/C/messages.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 071fc7fc8..38fe8606f 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-08 23:14+0000\n" +"POT-Creation-Date: 2023-01-08 23:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1926,8 +1926,8 @@ msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3561 -#: src/Model/Item.php:3567 src/Model/Item.php:3568 +#: src/Content/Text/BBCode.php:1257 src/Model/Item.php:3562 +#: src/Model/Item.php:3568 src/Model/Item.php:3569 msgid "Link to source" msgstr "" @@ -3118,49 +3118,49 @@ msgstr "" msgid "Content from %s is collapsed" msgstr "" -#: src/Model/Item.php:3055 +#: src/Model/Item.php:3056 #, php-format msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3473 +#: src/Model/Item.php:3474 msgid "bytes" msgstr "" -#: src/Model/Item.php:3504 +#: src/Model/Item.php:3505 #, 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:3506 +#: src/Model/Item.php:3507 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3511 +#: src/Model/Item.php:3512 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3513 +#: src/Model/Item.php:3514 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3515 +#: src/Model/Item.php:3516 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3549 src/Model/Item.php:3550 +#: src/Model/Item.php:3550 src/Model/Item.php:3551 msgid "View on separate page" msgstr "" @@ -5636,7 +5636,7 @@ msgstr "" msgid "Only show ignored contacts" msgstr "" -#: src/Module/Contact.php:371 +#: src/Module/Contact.php:371 src/Module/Contact.php:419 msgid "Collapsed" msgstr "" @@ -5664,10 +5664,6 @@ msgstr "" msgid "Organize your contact groups" msgstr "" -#: src/Module/Contact.php:419 -msgid "collapsed" -msgstr "" - #: src/Module/Contact.php:431 msgid "Search your contacts" msgstr "" @@ -5958,7 +5954,11 @@ msgstr "" msgid "Contact has been ignored" msgstr "" -#: src/Module/Contact/Profile.php:210 src/Module/Contact/Profile.php:214 +#: src/Module/Contact/Profile.php:210 +msgid "Contact has been uncollapsed" +msgstr "" + +#: src/Module/Contact/Profile.php:214 msgid "Contact has been collapsed" msgstr ""