From 229e7dcee53523e8c90bb212a7ca30e476252e75 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 12 Sep 2023 10:55:33 +0000 Subject: [PATCH 01/20] Channel visibility rules can now be set for each contact --- database.sql | 3 +- doc/database/db_user-contact.md | 1 + src/Model/Contact/User.php | 51 +++++ src/Module/Contact/Profile.php | 27 +++ src/Module/Conversation/Timeline.php | 62 +++++- static/dbstructure.config.php | 3 +- static/defaults.config.php | 4 + view/lang/C/messages.po | 242 ++++++++++++--------- view/templates/contact_edit.tpl | 5 + view/theme/frio/templates/contact_edit.tpl | 22 ++ 10 files changed, 308 insertions(+), 112 deletions(-) diff --git a/database.sql b/database.sql index 6a7cb50e2c..131942c1f8 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.09-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1532 +-- DB_UPDATE_VERSION 1533 -- ------------------------------------------ @@ -1866,6 +1866,7 @@ CREATE TABLE IF NOT EXISTS `user-contact` ( `collapsed` boolean COMMENT 'Posts from this contact are collapsed', `hidden` boolean COMMENT 'This contact is hidden from the others', `is-blocked` boolean COMMENT 'User is blocked by this contact', + `channel-visibility` tinyint unsigned COMMENT 'Controls the visibility in channels', `pending` boolean COMMENT '', `rel` tinyint unsigned COMMENT 'The kind of the relation between the user and the contact', `info` mediumtext COMMENT '', diff --git a/doc/database/db_user-contact.md b/doc/database/db_user-contact.md index ac89aab1de..60b3c44b01 100644 --- a/doc/database/db_user-contact.md +++ b/doc/database/db_user-contact.md @@ -16,6 +16,7 @@ Fields | collapsed | Posts from this contact are collapsed | boolean | YES | | NULL | | | hidden | This contact is hidden from the others | boolean | YES | | NULL | | | is-blocked | User is blocked by this contact | boolean | YES | | NULL | | +| channel-visibility | Controls the visibility in channels | tinyint unsigned | YES | | NULL | | | pending | | boolean | YES | | NULL | | | rel | The kind of the relation between the user and the contact | tinyint unsigned | YES | | NULL | | | info | | mediumtext | YES | | NULL | | diff --git a/src/Model/Contact/User.php b/src/Model/Contact/User.php index 8c214a5c9b..ff2f093cf4 100644 --- a/src/Model/Contact/User.php +++ b/src/Model/Contact/User.php @@ -37,6 +37,10 @@ use PDOException; */ class User { + const VISIBILITY_DEFAULT = 0; + const VISIBILITY_NEVER = 1; + const VISIBILITY_ALWAYS = 2; + const VISIBILITY_REDUCED = 3; /** * Insert a user-contact for a given contact array * @@ -314,6 +318,53 @@ class User return $collapsed; } + /** + * Set the channel visibility for contact id and user id + * + * @param int $cid Either public contact id or user's contact id + * @param int $uid User ID + * @param int $visibility Set type of visibility + * @return void + * @throws \Exception + */ + public static function setChannelVisibility(int $cid, int $uid, int $visibility) + { + $cdata = Contact::getPublicAndUserContactID($cid, $uid); + if (empty($cdata)) { + return; + } + + DBA::update('user-contact', ['channel-visibility' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true); + } + + /** + * Returns the channel visibility state for contact id and user id + * + * @param int $cid Either public contact id or user's contact id + * @param int $uid User ID + * @return int the type of visibility in channels + * @throws HTTPException\InternalServerErrorException + * @throws \ImagickException + */ + public static function getChannelVisibility(int $cid, int $uid): int + { + $cdata = Contact::getPublicAndUserContactID($cid, $uid); + if (empty($cdata)) { + return false; + } + + $visibility = self::VISIBILITY_DEFAULT; + + if (!empty($cdata['public'])) { + $public_contact = DBA::selectFirst('user-contact', ['channel-visibility'], ['cid' => $cdata['public'], 'uid' => $uid]); + if (DBA::isResult($public_contact)) { + $visibility = $public_contact['channel-visibility'] ?? self::VISIBILITY_DEFAULT; + } + } + + return $visibility; + } + /** * Set/Release that the user is blocked by the contact * diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index e6dedf1b41..7fa64cdcee 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -132,6 +132,10 @@ class Profile extends BaseModule $fields['info'] = $_POST['info']; } + if (isset($_POST['channel_visibility'])) { + Contact\User::setChannelVisibility($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_visibility']); + } + if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => $this->session->getLocalUserId()])) { $this->systemMessages->addNotice($this->t('Failed to update contact record.')); } @@ -336,6 +340,21 @@ class Profile extends BaseModule ]; } + if (in_array($contact['network'], Protocol::FEDERATED)) { + $channel_settings_label = $this->t('Channel Settings'); + $channel_visibility = Contact\User::getChannelVisibility($contact['id'], $this->session->getLocalUserId()); + $channel_visibilities = [ + Contact\User::VISIBILITY_DEFAULT => $this->t('Default visibility'), + Contact\User::VISIBILITY_ALWAYS => $this->t('Display all posts of this contact'), + Contact\User::VISIBILITY_REDUCED => $this->t('Display only few posts'), + Contact\User::VISIBILITY_NEVER => $this->t('Never display posts from this contact'), + ]; + } else { + $channel_settings_label = null; + $channel_visibility = null; + $channel_visibilities = null; + } + $poll_interval = null; if ((($contact['network'] == Protocol::FEED) && !$this->config->get('system', 'adjust_poll_frequency')) || ($contact['network'] == Protocol::MAIL)) { $poll_interval = ContactSelector::pollInterval($localRelationship->priority, !$poll_enabled); @@ -419,6 +438,14 @@ class Profile extends BaseModule $this->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options ], + '$channel_settings_label' => $channel_settings_label, + '$channel_visibility' => [ + 'channel_visibility', + $this->t('Visibility of this contact in appropriate channels'), + $channel_visibility, + $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), + $channel_visibilities + ], ]); $arr = ['contact' => $contact, 'output' => $o]; diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index 372f8c80a3..0456c8e1d0 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -188,14 +188,64 @@ class Timeline extends BaseModule * @throws \Exception */ protected function getChannelItems() + { + $items = $this->getRawChannelItems(); + + $contacts = $this->database->selectToArray('user-contact', ['cid'], ['channel-visibility' => Contact\User::VISIBILITY_REDUCED, 'cid' => array_column($items, 'owner-id')]); + $reduced = array_column($contacts, 'cid'); + + $maxpostperauthor = $this->config->get('channel', 'max_posts_per_author'); + + if ($maxpostperauthor != 0) { + $count = 1; + $numposts = []; + $selected_items = []; + + while (count($selected_items) < $this->itemsPerPage && ++$count < 50 && count($items) > 0) { + foreach ($items as $item) { + if (!in_array($item['owner-id'], $reduced) || (($numposts[$item['owner-id']]++ < $maxpostperauthor)) && (count($selected_items) < $this->itemsPerPage)) { + $selected_items[] = $item; + } + } + + // If we're looking at a "previous page", the lookup continues forward in time because the list is + // sorted in chronologically decreasing order + if (isset($this->minId)) { + $this->minId = $items[0]['created']; + } else { + // In any other case, the lookup continues backwards in time + $this->maxId = $items[count($items) - 1]['created']; + } + + if (count($selected_items) < $this->itemsPerPage) { + $items = $this->getRawChannelItems(); + } + } + } else { + $selected_items = $items; + } + + $condition = ['unseen' => true, 'uid' => $this->session->getLocalUserId(), 'parent-uri-id' => array_column($selected_items, 'uri-id')]; + $this->setItemsSeenByCondition($condition); + + return $selected_items; + } + + /** + * Database query for the channel page + * + * @return array + * @throws \Exception + */ + private function getRawChannelItems() { $uid = $this->session->getLocalUserId(); if ($this->selectedTab == TimelineEntity::WHATSHOT) { if (!is_null($this->accountType)) { - $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` = ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $this->accountType]; + $condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` = ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $this->accountType]; } else { - $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), Contact::TYPE_COMMUNITY]; + $condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` != ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), Contact::TYPE_COMMUNITY]; } } elseif ($this->selectedTab == TimelineEntity::FORYOU) { $cid = Contact::getPublicIdByUserId($uid); @@ -203,9 +253,9 @@ class Timeline extends BaseModule $condition = [ "(`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `relation-thread-score` > ?) OR ((`comments` >= ? OR `activities` >= ?) AND `owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `follows` AND `relation-cid` = ?)) OR - (`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` IN (?, ?) AND `notify_new_posts`)))", + (`owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`notify_new_posts` OR `channel-visibility` = ?))))", $cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid, - $uid, Contact::FRIEND, Contact::SHARING + $uid, Contact\User::VISIBILITY_ALWAYS ]; } elseif ($this->selectedTab == TimelineEntity::FOLLOWERS) { $condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER]; @@ -233,7 +283,7 @@ class Timeline extends BaseModule $condition = $this->addLanguageCondition($uid, $condition); } - $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed`))", $uid]); + $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed` OR `is-blocked` OR `channel-visibility` = ?))", $uid, Contact\User::VISIBILITY_NEVER]); if (($this->selectedTab != TimelineEntity::WHATSHOT) && !is_null($this->accountType)) { $condition = DBA::mergeConditions($condition, ['contact-type' => $this->accountType]); @@ -262,7 +312,7 @@ class Timeline extends BaseModule } } - $items = $this->database->selectToArray('post-engagement', ['uri-id', 'created'], $condition, $params); + $items = $this->database->selectToArray('post-engagement', ['uri-id', 'created', 'owner-id'], $condition, $params); if (empty($items)) { return []; } diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index cc03bb98e4..a2f392c785 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -56,7 +56,7 @@ use Friendica\Database\DBA; // This file is required several times during the test in DbaDefinition which justifies this condition if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1532); + define('DB_UPDATE_VERSION', 1533); } return [ @@ -1857,6 +1857,7 @@ return [ "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"], "hidden" => ["type" => "boolean", "comment" => "This contact is hidden from the others"], "is-blocked" => ["type" => "boolean", "comment" => "User is blocked by this contact"], + "channel-visibility" => ["type" => "tinyint unsigned", "comment" => "Controls the visibility in channels"], "pending" => ["type" => "boolean", "comment" => ""], "rel" => ["type" => "tinyint unsigned", "comment" => "The kind of the relation between the user and the contact"], "info" => ["type" => "mediumtext", "comment" => ""], diff --git a/static/defaults.config.php b/static/defaults.config.php index 75c349de5b..ceb60c4151 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -805,6 +805,10 @@ return [ // Number of days that are used to calculate the interaction score. 'interaction_score_days' => 30, + // max_posts_per_author (Integer) + // Maixmum number of posts per page by author + 'max_posts_per_author' => 2, + // sharer_interaction_days (Integer) // Number of days of the last interaction that are used to define which sharers are used for the "sharers of sharers" channel. 'sharer_interaction_days' => 90, diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 8720f34231..3c7496350b 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-10 07:51+0000\n" +"POT-Creation-Date: 2023-09-12 10:52+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -302,7 +302,7 @@ msgstr "" #: mod/photos.php:824 mod/photos.php:1101 mod/photos.php:1142 #: mod/photos.php:1198 mod/photos.php:1278 #: src/Module/Calendar/Event/Form.php:250 src/Module/Contact/Advanced.php:132 -#: src/Module/Contact/Profile.php:358 +#: src/Module/Contact/Profile.php:377 #: 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 @@ -606,7 +606,7 @@ msgid "This is you" msgstr "" #: mod/photos.php:1141 mod/photos.php:1197 mod/photos.php:1277 -#: src/Module/Moderation/Reports.php:96 src/Object/Post.php:572 +#: src/Module/Moderation/Reports.php:95 src/Object/Post.php:572 #: src/Object/Post.php:1094 msgid "Comment" msgstr "" @@ -661,7 +661,7 @@ msgstr "" msgid "No system theme config value set." msgstr "" -#: src/App.php:577 +#: src/App.php:580 msgid "Apologies but the website is unavailable at the moment." msgstr "" @@ -1813,7 +1813,7 @@ msgid "Send PM" msgstr "" #: src/Content/Item.php:435 src/Module/Contact.php:468 -#: src/Module/Contact/Profile.php:498 +#: src/Module/Contact/Profile.php:525 #: src/Module/Moderation/Blocklist/Contact.php:116 #: src/Module/Moderation/Users/Active.php:137 #: src/Module/Moderation/Users/Index.php:152 @@ -1821,7 +1821,7 @@ msgid "Block" msgstr "" #: src/Content/Item.php:436 src/Module/Contact.php:469 -#: src/Module/Contact/Profile.php:506 +#: src/Module/Contact/Profile.php:533 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Notification.php:89 @@ -1829,7 +1829,7 @@ msgid "Ignore" msgstr "" #: src/Content/Item.php:437 src/Module/Contact.php:470 -#: src/Module/Contact/Profile.php:514 +#: src/Module/Contact/Profile.php:541 msgid "Collapse" msgstr "" @@ -1896,7 +1896,7 @@ msgstr "" #: src/Content/Nav.php:230 src/Module/BaseProfile.php:49 #: src/Module/BaseSettings.php:98 src/Module/Contact.php:504 -#: src/Module/Contact/Profile.php:413 src/Module/Profile/Profile.php:268 +#: src/Module/Contact/Profile.php:432 src/Module/Profile/Profile.php:268 #: src/Module/Welcome.php:57 view/theme/frio/theme.php:230 msgid "Profile" msgstr "" @@ -2126,7 +2126,7 @@ msgstr "" #: src/Module/Moderation/Blocklist/Server/Import.php:118 #: src/Module/Moderation/Blocklist/Server/Index.php:95 #: src/Module/Moderation/Item/Delete.php:61 -#: src/Module/Moderation/Reports.php:90 src/Module/Moderation/Summary.php:76 +#: src/Module/Moderation/Reports.php:89 src/Module/Moderation/Summary.php:76 #: src/Module/Moderation/Users/Active.php:133 #: src/Module/Moderation/Users/Blocked.php:133 #: src/Module/Moderation/Users/Deleted.php:80 @@ -2215,7 +2215,7 @@ msgid "The end" msgstr "" #: src/Content/Text/HTML.php:859 src/Content/Widget/VCard.php:116 -#: src/Model/Profile.php:461 src/Module/Contact/Profile.php:458 +#: src/Model/Profile.php:461 src/Module/Contact/Profile.php:485 msgid "Follow" msgstr "" @@ -2413,18 +2413,18 @@ msgid "More Trending Tags" msgstr "" #: src/Content/Widget/VCard.php:109 src/Model/Profile.php:376 -#: src/Module/Contact/Profile.php:402 src/Module/Profile/Profile.php:199 +#: src/Module/Contact/Profile.php:421 src/Module/Profile/Profile.php:199 msgid "XMPP:" msgstr "" #: src/Content/Widget/VCard.php:110 src/Model/Profile.php:377 -#: src/Module/Contact/Profile.php:404 src/Module/Profile/Profile.php:203 +#: src/Module/Contact/Profile.php:423 src/Module/Profile/Profile.php:203 msgid "Matrix:" msgstr "" #: src/Content/Widget/VCard.php:111 src/Model/Event.php:82 #: src/Model/Event.php:109 src/Model/Event.php:471 src/Model/Event.php:963 -#: src/Model/Profile.php:371 src/Module/Contact/Profile.php:400 +#: src/Model/Profile.php:371 src/Module/Contact/Profile.php:419 #: src/Module/Directory.php:147 src/Module/Notifications/Introductions.php:187 #: src/Module/Profile/Profile.php:221 msgid "Location:" @@ -2437,7 +2437,7 @@ msgstr "" #: src/Content/Widget/VCard.php:118 src/Model/Contact.php:1223 #: src/Model/Contact.php:1234 src/Model/Profile.php:463 -#: src/Module/Contact/Profile.php:450 +#: src/Module/Contact/Profile.php:477 msgid "Unfollow" msgstr "" @@ -3469,7 +3469,7 @@ msgstr "" msgid "Homepage:" msgstr "" -#: src/Model/Profile.php:375 src/Module/Contact/Profile.php:406 +#: src/Model/Profile.php:375 src/Module/Contact/Profile.php:425 #: src/Module/Notifications/Introductions.php:189 msgid "About:" msgstr "" @@ -4276,7 +4276,7 @@ msgstr "" msgid "Job Parameters" msgstr "" -#: src/Module/Admin/Queue.php:78 src/Module/Moderation/Reports.php:96 +#: src/Module/Admin/Queue.php:78 src/Module/Moderation/Reports.php:95 #: src/Module/Settings/OAuth.php:74 msgid "Created" msgstr "" @@ -5182,7 +5182,7 @@ msgid "" "received." msgstr "" -#: src/Module/Admin/Site.php:513 src/Module/Contact/Profile.php:305 +#: src/Module/Admin/Site.php:513 src/Module/Contact/Profile.php:309 #: src/Module/Settings/TwoFactor/Index.php:125 msgid "Disabled" msgstr "" @@ -5670,7 +5670,7 @@ msgid "" "the main account." msgstr "" -#: src/Module/BaseModeration.php:110 src/Module/Moderation/Reports.php:95 +#: src/Module/BaseModeration.php:110 src/Module/Moderation/Reports.php:94 msgid "Reports" msgstr "" @@ -5929,8 +5929,8 @@ msgstr "" #: src/Module/Contact/Conversations.php:89 #: src/Module/Contact/Conversations.php:94 src/Module/Contact/Media.php:43 #: src/Module/Contact/Posts.php:78 src/Module/Contact/Posts.php:83 -#: src/Module/Contact/Posts.php:88 src/Module/Contact/Profile.php:150 -#: src/Module/Contact/Profile.php:155 src/Module/Contact/Profile.php:160 +#: src/Module/Contact/Posts.php:88 src/Module/Contact/Profile.php:154 +#: src/Module/Contact/Profile.php:159 src/Module/Contact/Profile.php:164 #: src/Module/Contact/Redir.php:94 src/Module/Contact/Redir.php:140 #: src/Module/FriendSuggest.php:71 src/Module/FriendSuggest.php:109 msgid "Contact not found." @@ -6088,18 +6088,18 @@ msgstr "" msgid "Update" msgstr "" -#: src/Module/Contact.php:468 src/Module/Contact/Profile.php:498 +#: src/Module/Contact.php:468 src/Module/Contact/Profile.php:525 #: 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:469 src/Module/Contact/Profile.php:506 +#: src/Module/Contact.php:469 src/Module/Contact/Profile.php:533 msgid "Unignore" msgstr "" -#: src/Module/Contact.php:470 src/Module/Contact/Profile.php:514 +#: src/Module/Contact.php:470 src/Module/Contact/Profile.php:541 msgid "Uncollapse" msgstr "" @@ -6151,7 +6151,7 @@ msgstr "" msgid "Pending incoming contact request" msgstr "" -#: src/Module/Contact.php:627 src/Module/Contact/Profile.php:365 +#: src/Module/Contact.php:627 src/Module/Contact/Profile.php:384 #, php-format msgid "Visit %s's profile [%s]" msgstr "" @@ -6166,7 +6166,7 @@ msgstr "" #: src/Module/Contact/Advanced.php:134 #: src/Module/Moderation/Blocklist/Contact.php:122 -#: src/Module/Moderation/Reports.php:96 +#: src/Module/Moderation/Reports.php:95 #: src/Module/Moderation/Users/Active.php:126 #: src/Module/Moderation/Users/Blocked.php:126 #: src/Module/Moderation/Users/Create.php:70 @@ -6287,16 +6287,16 @@ msgstr "" msgid "Your Identity Address:" msgstr "" -#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:396 +#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:415 #: src/Module/Contact/Unfollow.php:129 #: src/Module/Moderation/Blocklist/Contact.php:133 -#: src/Module/Moderation/Reports.php:105 +#: src/Module/Moderation/Reports.php:104 #: src/Module/Notifications/Introductions.php:129 #: src/Module/Notifications/Introductions.php:198 msgid "Profile URL" msgstr "" -#: src/Module/Contact/Follow.php:171 src/Module/Contact/Profile.php:408 +#: src/Module/Contact/Follow.php:171 src/Module/Contact/Profile.php:427 #: src/Module/Notifications/Introductions.php:191 #: src/Module/Profile/Profile.php:234 msgid "Tags:" @@ -6335,257 +6335,291 @@ msgstr "" msgid "Profile Match" msgstr "" -#: src/Module/Contact/Profile.php:136 +#: src/Module/Contact/Profile.php:140 msgid "Failed to update contact record." msgstr "" -#: src/Module/Contact/Profile.php:186 +#: src/Module/Contact/Profile.php:190 msgid "Contact has been unblocked" msgstr "" -#: src/Module/Contact/Profile.php:190 +#: src/Module/Contact/Profile.php:194 msgid "Contact has been blocked" msgstr "" -#: src/Module/Contact/Profile.php:202 +#: src/Module/Contact/Profile.php:206 msgid "Contact has been unignored" msgstr "" -#: src/Module/Contact/Profile.php:206 +#: src/Module/Contact/Profile.php:210 msgid "Contact has been ignored" msgstr "" -#: src/Module/Contact/Profile.php:218 +#: src/Module/Contact/Profile.php:222 msgid "Contact has been uncollapsed" msgstr "" -#: src/Module/Contact/Profile.php:222 +#: src/Module/Contact/Profile.php:226 msgid "Contact has been collapsed" msgstr "" -#: src/Module/Contact/Profile.php:250 +#: src/Module/Contact/Profile.php:254 #, php-format msgid "You are mutual friends with %s" msgstr "" -#: src/Module/Contact/Profile.php:251 +#: src/Module/Contact/Profile.php:255 #, php-format msgid "You are sharing with %s" msgstr "" -#: src/Module/Contact/Profile.php:252 +#: src/Module/Contact/Profile.php:256 #, php-format msgid "%s is sharing with you" msgstr "" -#: src/Module/Contact/Profile.php:268 +#: src/Module/Contact/Profile.php:272 msgid "Private communications are not available for this contact." msgstr "" -#: src/Module/Contact/Profile.php:278 +#: src/Module/Contact/Profile.php:282 msgid "This contact is on a server you ignored." msgstr "" -#: src/Module/Contact/Profile.php:281 +#: src/Module/Contact/Profile.php:285 msgid "Never" msgstr "" -#: src/Module/Contact/Profile.php:284 +#: src/Module/Contact/Profile.php:288 msgid "(Update was not successful)" msgstr "" -#: src/Module/Contact/Profile.php:284 +#: src/Module/Contact/Profile.php:288 msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:286 src/Module/Contact/Profile.php:469 +#: src/Module/Contact/Profile.php:290 src/Module/Contact/Profile.php:496 msgid "Suggest friends" msgstr "" -#: src/Module/Contact/Profile.php:290 +#: src/Module/Contact/Profile.php:294 #, php-format msgid "Network type: %s" msgstr "" -#: src/Module/Contact/Profile.php:295 +#: src/Module/Contact/Profile.php:299 msgid "Communications lost with this contact!" msgstr "" -#: src/Module/Contact/Profile.php:301 +#: src/Module/Contact/Profile.php:305 msgid "Fetch further information for feeds" msgstr "" -#: src/Module/Contact/Profile.php:303 +#: src/Module/Contact/Profile.php:307 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:306 +#: src/Module/Contact/Profile.php:310 msgid "Fetch information" msgstr "" -#: src/Module/Contact/Profile.php:307 +#: src/Module/Contact/Profile.php:311 msgid "Fetch keywords" msgstr "" -#: src/Module/Contact/Profile.php:308 +#: src/Module/Contact/Profile.php:312 msgid "Fetch information and keywords" msgstr "" -#: src/Module/Contact/Profile.php:318 src/Module/Contact/Profile.php:323 -#: src/Module/Contact/Profile.php:328 src/Module/Contact/Profile.php:334 +#: src/Module/Contact/Profile.php:322 src/Module/Contact/Profile.php:327 +#: src/Module/Contact/Profile.php:332 src/Module/Contact/Profile.php:338 msgid "No mirroring" msgstr "" -#: src/Module/Contact/Profile.php:319 src/Module/Contact/Profile.php:329 -#: src/Module/Contact/Profile.php:335 +#: src/Module/Contact/Profile.php:323 src/Module/Contact/Profile.php:333 +#: src/Module/Contact/Profile.php:339 msgid "Mirror as my own posting" msgstr "" -#: src/Module/Contact/Profile.php:324 src/Module/Contact/Profile.php:330 +#: src/Module/Contact/Profile.php:328 src/Module/Contact/Profile.php:334 msgid "Native reshare" msgstr "" +#: src/Module/Contact/Profile.php:344 +msgid "Channel Settings" +msgstr "" + #: src/Module/Contact/Profile.php:347 -msgid "Contact Information / Notes" +msgid "Default visibility" msgstr "" #: src/Module/Contact/Profile.php:348 -msgid "Contact Settings" +msgid "Display all posts of this contact" msgstr "" -#: src/Module/Contact/Profile.php:356 -msgid "Contact" +#: src/Module/Contact/Profile.php:349 +msgid "Display only few posts" msgstr "" -#: src/Module/Contact/Profile.php:360 -msgid "Their personal note" -msgstr "" - -#: src/Module/Contact/Profile.php:362 -msgid "Edit contact notes" +#: src/Module/Contact/Profile.php:350 +msgid "Never display posts from this contact" msgstr "" #: src/Module/Contact/Profile.php:366 -msgid "Block/Unblock contact" +msgid "Contact Information / Notes" msgstr "" #: src/Module/Contact/Profile.php:367 +msgid "Contact Settings" +msgstr "" + +#: src/Module/Contact/Profile.php:375 +msgid "Contact" +msgstr "" + +#: src/Module/Contact/Profile.php:379 +msgid "Their personal note" +msgstr "" + +#: src/Module/Contact/Profile.php:381 +msgid "Edit contact notes" +msgstr "" + +#: src/Module/Contact/Profile.php:385 +msgid "Block/Unblock contact" +msgstr "" + +#: src/Module/Contact/Profile.php:386 #: src/Module/Moderation/Report/Create.php:293 msgid "Ignore contact" msgstr "" -#: src/Module/Contact/Profile.php:368 +#: src/Module/Contact/Profile.php:387 msgid "View conversations" msgstr "" -#: src/Module/Contact/Profile.php:373 +#: src/Module/Contact/Profile.php:392 msgid "Last update:" msgstr "" -#: src/Module/Contact/Profile.php:375 +#: src/Module/Contact/Profile.php:394 msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:377 src/Module/Contact/Profile.php:479 +#: src/Module/Contact/Profile.php:396 src/Module/Contact/Profile.php:506 msgid "Update now" msgstr "" -#: src/Module/Contact/Profile.php:379 +#: src/Module/Contact/Profile.php:398 msgid "Awaiting connection acknowledge" msgstr "" -#: src/Module/Contact/Profile.php:380 +#: src/Module/Contact/Profile.php:399 msgid "Currently blocked" msgstr "" -#: src/Module/Contact/Profile.php:381 +#: src/Module/Contact/Profile.php:400 msgid "Currently ignored" msgstr "" -#: src/Module/Contact/Profile.php:382 +#: src/Module/Contact/Profile.php:401 msgid "Currently collapsed" msgstr "" -#: src/Module/Contact/Profile.php:383 +#: src/Module/Contact/Profile.php:402 msgid "Currently archived" msgstr "" -#: src/Module/Contact/Profile.php:386 +#: src/Module/Contact/Profile.php:405 msgid "Manage remote servers" msgstr "" -#: src/Module/Contact/Profile.php:388 +#: src/Module/Contact/Profile.php:407 #: src/Module/Notifications/Introductions.php:192 msgid "Hide this contact from others" msgstr "" -#: src/Module/Contact/Profile.php:388 +#: src/Module/Contact/Profile.php:407 msgid "" "Replies/likes to your public posts may still be visible" msgstr "" -#: src/Module/Contact/Profile.php:389 +#: src/Module/Contact/Profile.php:408 msgid "Notification for new posts" msgstr "" -#: src/Module/Contact/Profile.php:389 +#: src/Module/Contact/Profile.php:408 msgid "Send a notification of every new post of this contact" msgstr "" -#: src/Module/Contact/Profile.php:391 +#: src/Module/Contact/Profile.php:410 msgid "Keyword Deny List" msgstr "" -#: src/Module/Contact/Profile.php:391 +#: src/Module/Contact/Profile.php:410 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:409 +#: src/Module/Contact/Profile.php:428 #: src/Module/Settings/TwoFactor/Index.php:139 msgid "Actions" msgstr "" -#: src/Module/Contact/Profile.php:411 +#: src/Module/Contact/Profile.php:430 #: src/Module/Settings/TwoFactor/Index.php:119 view/theme/frio/theme.php:229 msgid "Status" msgstr "" -#: src/Module/Contact/Profile.php:417 +#: src/Module/Contact/Profile.php:436 msgid "Mirror postings from this contact" msgstr "" -#: src/Module/Contact/Profile.php:419 +#: src/Module/Contact/Profile.php:438 msgid "" "Mark this contact as remote_self, this will cause friendica to repost new " "entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:489 -msgid "Refetch contact data" +#: src/Module/Contact/Profile.php:444 +msgid "Visibility of this contact in appropriate channels" msgstr "" -#: src/Module/Contact/Profile.php:500 -msgid "Toggle Blocked status" -msgstr "" - -#: src/Module/Contact/Profile.php:508 -msgid "Toggle Ignored status" +#: src/Module/Contact/Profile.php:446 +msgid "" +"Depending on the type of the channel not all posts from contacts are " +"displayed by default. They for example need to have a certain amount of " +"comments to be displayed. On the other hand there can be contacts who flood " +"the channel, so you might want to see only some of their posts. Or you don't " +"want to see their content at all, but you don't want to block or hide the " +"contact completely." msgstr "" #: src/Module/Contact/Profile.php:516 +msgid "Refetch contact data" +msgstr "" + +#: src/Module/Contact/Profile.php:527 +msgid "Toggle Blocked status" +msgstr "" + +#: src/Module/Contact/Profile.php:535 +msgid "Toggle Ignored status" +msgstr "" + +#: src/Module/Contact/Profile.php:543 msgid "Toggle Collapsed status" msgstr "" -#: src/Module/Contact/Profile.php:523 src/Module/Contact/Revoke.php:106 +#: src/Module/Contact/Profile.php:550 src/Module/Contact/Revoke.php:106 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:525 +#: src/Module/Contact/Profile.php:552 msgid "Revoke the follow from this contact" msgstr "" @@ -7585,7 +7619,7 @@ msgid "Block New Remote Contact" msgstr "" #: src/Module/Moderation/Blocklist/Contact.php:122 -#: src/Module/Moderation/Reports.php:96 +#: src/Module/Moderation/Reports.php:95 msgid "Photo" msgstr "" @@ -8147,30 +8181,30 @@ msgstr "" msgid "3. Pick posts" msgstr "" -#: src/Module/Moderation/Reports.php:91 +#: src/Module/Moderation/Reports.php:90 msgid "List of reports" msgstr "" -#: src/Module/Moderation/Reports.php:92 +#: src/Module/Moderation/Reports.php:91 msgid "This page display reports created by our or remote users." msgstr "" -#: src/Module/Moderation/Reports.php:93 +#: src/Module/Moderation/Reports.php:92 msgid "No report exists at this node." msgstr "" -#: src/Module/Moderation/Reports.php:96 +#: src/Module/Moderation/Reports.php:95 msgid "Category" msgstr "" -#: src/Module/Moderation/Reports.php:102 +#: src/Module/Moderation/Reports.php:101 #, php-format msgid "%s total report" msgid_plural "%s total reports" msgstr[0] "" msgstr[1] "" -#: src/Module/Moderation/Reports.php:105 +#: src/Module/Moderation/Reports.php:104 msgid "URL of the reported contact." msgstr "" diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index a9105d696c..e997dcb2c7 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -91,6 +91,11 @@
{{/if}} + {{if $channel_settings_label}} +

{{$channel_settings_label}}

+ {{include file="field_select.tpl" field=$channel_visibility}} + {{/if}} + {{/if}} diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index 56459df718..ab40bde678 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -189,6 +189,28 @@ {{/if}} + {{if $channel_settings_label}} +
+ +
+
+ + {{include file="field_select.tpl" field=$channel_visibility}} + +
+ +
+
+
+
+
+ {{/if}} {{* End of the form *}} From 1530209266c7b8c972fb88fb6611ab05d6d07414 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 13 Sep 2023 04:38:04 +0000 Subject: [PATCH 02/20] Initialize array --- src/Module/Conversation/Timeline.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index 0456c8e1d0..5ee5a7b674 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -203,6 +203,7 @@ class Timeline extends BaseModule while (count($selected_items) < $this->itemsPerPage && ++$count < 50 && count($items) > 0) { foreach ($items as $item) { + $numposts[$item['owner-id']] = ($numposts[$item['owner-id']] ?? 0); if (!in_array($item['owner-id'], $reduced) || (($numposts[$item['owner-id']]++ < $maxpostperauthor)) && (count($selected_items) < $this->itemsPerPage)) { $selected_items[] = $item; } From 54aea9dbee355d1d0ac7f03878b0c514fc181a9e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 15 Sep 2023 17:40:14 +0000 Subject: [PATCH 03/20] Changed to radio buttons --- src/Module/Contact/Profile.php | 8 +++++++- view/templates/contact_edit.tpl | 7 ++++++- view/theme/frio/templates/contact_edit.tpl | 9 +++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 7fa64cdcee..a2b6bc9058 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -446,7 +446,13 @@ class Profile extends BaseModule $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), $channel_visibilities ], - ]); + '$visibility_label' => $this->t('Visibility of this contact in appropriate channels'), + '$visibility_description' => $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), + '$visibility_default' => ['channel_visibility', $this->t('Default visibility'), Contact\User::VISIBILITY_DEFAULT, $this->t('When activated, posts by this contact are displayed in the "for you" channel, if either you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], + '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, then every post of this contact will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], + '$visibility_reduced' => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED], + '$visibility_never' => ['channel_visibility', $this->t('Never display posts from this contact'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER], + ]); $arr = ['contact' => $contact, 'output' => $o]; diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index e997dcb2c7..f17743f765 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -93,7 +93,12 @@ {{/if}} {{if $channel_settings_label}}

{{$channel_settings_label}}

- {{include file="field_select.tpl" field=$channel_visibility}} + + {{include file="field_radio.tpl" field=$visibility_default}} + {{include file="field_radio.tpl" field=$visibility_always}} + {{include file="field_radio.tpl" field=$visibility_reduced}} + {{include file="field_radio.tpl" field=$visibility_never}} +

{{$visibility_description}}

{{/if}} diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index ab40bde678..c9f8423602 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -201,8 +201,13 @@
- {{include file="field_select.tpl" field=$channel_visibility}} - + + {{include file="field_radio.tpl" field=$visibility_default}} + {{include file="field_radio.tpl" field=$visibility_always}} + {{include file="field_radio.tpl" field=$visibility_reduced}} + {{include file="field_radio.tpl" field=$visibility_never}} +

{{$visibility_description}}

+
From 7b26c08dffc1cb7bb6ff6ae554894670b604f5e1 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 15 Sep 2023 20:56:25 +0200 Subject: [PATCH 04/20] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Module/Contact/Profile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index a2b6bc9058..3119b88dda 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -446,8 +446,8 @@ class Profile extends BaseModule $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), $channel_visibilities ], - '$visibility_label' => $this->t('Visibility of this contact in appropriate channels'), - '$visibility_description' => $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), + '$visibility_label' => $this->t('Frequency of this contact in relevant channels'), + '$visibility_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), '$visibility_default' => ['channel_visibility', $this->t('Default visibility'), Contact\User::VISIBILITY_DEFAULT, $this->t('When activated, posts by this contact are displayed in the "for you" channel, if either you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, then every post of this contact will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], '$visibility_reduced' => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED], From 20141026d126d30a3d6e6e323a5f41aa04af476b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 15 Sep 2023 20:57:03 +0200 Subject: [PATCH 05/20] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Module/Contact/Profile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 3119b88dda..14709d7bc1 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -448,8 +448,8 @@ class Profile extends BaseModule ], '$visibility_label' => $this->t('Frequency of this contact in relevant channels'), '$visibility_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), - '$visibility_default' => ['channel_visibility', $this->t('Default visibility'), Contact\User::VISIBILITY_DEFAULT, $this->t('When activated, posts by this contact are displayed in the "for you" channel, if either you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], - '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, then every post of this contact will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], + '$visibility_default' => ['channel_visibility', $this->t('Default frequency'), Contact\User::VISIBILITY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], + '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], '$visibility_reduced' => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED], '$visibility_never' => ['channel_visibility', $this->t('Never display posts from this contact'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER], ]); From a923a79b4613fe0ed4f6acd47ac40404212f0229 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 15 Sep 2023 20:57:36 +0200 Subject: [PATCH 06/20] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Module/Contact/Profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 14709d7bc1..51ab549e83 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -451,7 +451,7 @@ class Profile extends BaseModule '$visibility_default' => ['channel_visibility', $this->t('Default frequency'), Contact\User::VISIBILITY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], '$visibility_reduced' => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED], - '$visibility_never' => ['channel_visibility', $this->t('Never display posts from this contact'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER], + '$visibility_never' => ['channel_visibility', $this->t('Never display posts'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER], ]); $arr = ['contact' => $contact, 'output' => $o]; From a74212c3af1e23933df0ac8896c2b80e7d57dbdd Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 15 Sep 2023 19:01:01 +0000 Subject: [PATCH 07/20] Unused code removed --- src/Module/Contact/Profile.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 51ab549e83..c28d48c92e 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -343,16 +343,9 @@ class Profile extends BaseModule if (in_array($contact['network'], Protocol::FEDERATED)) { $channel_settings_label = $this->t('Channel Settings'); $channel_visibility = Contact\User::getChannelVisibility($contact['id'], $this->session->getLocalUserId()); - $channel_visibilities = [ - Contact\User::VISIBILITY_DEFAULT => $this->t('Default visibility'), - Contact\User::VISIBILITY_ALWAYS => $this->t('Display all posts of this contact'), - Contact\User::VISIBILITY_REDUCED => $this->t('Display only few posts'), - Contact\User::VISIBILITY_NEVER => $this->t('Never display posts from this contact'), - ]; } else { $channel_settings_label = null; $channel_visibility = null; - $channel_visibilities = null; } $poll_interval = null; @@ -439,13 +432,6 @@ class Profile extends BaseModule $remote_self_options ], '$channel_settings_label' => $channel_settings_label, - '$channel_visibility' => [ - 'channel_visibility', - $this->t('Visibility of this contact in appropriate channels'), - $channel_visibility, - $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'), - $channel_visibilities - ], '$visibility_label' => $this->t('Frequency of this contact in relevant channels'), '$visibility_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), '$visibility_default' => ['channel_visibility', $this->t('Default frequency'), Contact\User::VISIBILITY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], From 14ae901ba1a9284f4b1cc5091c9e5abb6f36b941 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 15 Sep 2023 19:07:27 +0000 Subject: [PATCH 08/20] Updated messages.po --- view/lang/C/messages.po | 183 ++++++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 80 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 3c7496350b..5c1470b57a 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-12 10:52+0000\n" +"POT-Creation-Date: 2023-09-15 19:05+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -302,7 +302,7 @@ msgstr "" #: mod/photos.php:824 mod/photos.php:1101 mod/photos.php:1142 #: mod/photos.php:1198 mod/photos.php:1278 #: src/Module/Calendar/Event/Form.php:250 src/Module/Contact/Advanced.php:132 -#: src/Module/Contact/Profile.php:377 +#: src/Module/Contact/Profile.php:370 #: 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 @@ -1813,7 +1813,7 @@ msgid "Send PM" msgstr "" #: src/Content/Item.php:435 src/Module/Contact.php:468 -#: src/Module/Contact/Profile.php:525 +#: src/Module/Contact/Profile.php:517 #: src/Module/Moderation/Blocklist/Contact.php:116 #: src/Module/Moderation/Users/Active.php:137 #: src/Module/Moderation/Users/Index.php:152 @@ -1821,7 +1821,7 @@ msgid "Block" msgstr "" #: src/Content/Item.php:436 src/Module/Contact.php:469 -#: src/Module/Contact/Profile.php:533 +#: src/Module/Contact/Profile.php:525 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Notification.php:89 @@ -1829,7 +1829,7 @@ msgid "Ignore" msgstr "" #: src/Content/Item.php:437 src/Module/Contact.php:470 -#: src/Module/Contact/Profile.php:541 +#: src/Module/Contact/Profile.php:533 msgid "Collapse" msgstr "" @@ -1896,7 +1896,7 @@ msgstr "" #: src/Content/Nav.php:230 src/Module/BaseProfile.php:49 #: src/Module/BaseSettings.php:98 src/Module/Contact.php:504 -#: src/Module/Contact/Profile.php:432 src/Module/Profile/Profile.php:268 +#: src/Module/Contact/Profile.php:425 src/Module/Profile/Profile.php:268 #: src/Module/Welcome.php:57 view/theme/frio/theme.php:230 msgid "Profile" msgstr "" @@ -2215,7 +2215,7 @@ msgid "The end" msgstr "" #: src/Content/Text/HTML.php:859 src/Content/Widget/VCard.php:116 -#: src/Model/Profile.php:461 src/Module/Contact/Profile.php:485 +#: src/Model/Profile.php:461 src/Module/Contact/Profile.php:477 msgid "Follow" msgstr "" @@ -2413,18 +2413,18 @@ msgid "More Trending Tags" msgstr "" #: src/Content/Widget/VCard.php:109 src/Model/Profile.php:376 -#: src/Module/Contact/Profile.php:421 src/Module/Profile/Profile.php:199 +#: src/Module/Contact/Profile.php:414 src/Module/Profile/Profile.php:199 msgid "XMPP:" msgstr "" #: src/Content/Widget/VCard.php:110 src/Model/Profile.php:377 -#: src/Module/Contact/Profile.php:423 src/Module/Profile/Profile.php:203 +#: src/Module/Contact/Profile.php:416 src/Module/Profile/Profile.php:203 msgid "Matrix:" msgstr "" #: src/Content/Widget/VCard.php:111 src/Model/Event.php:82 #: src/Model/Event.php:109 src/Model/Event.php:471 src/Model/Event.php:963 -#: src/Model/Profile.php:371 src/Module/Contact/Profile.php:419 +#: src/Model/Profile.php:371 src/Module/Contact/Profile.php:412 #: src/Module/Directory.php:147 src/Module/Notifications/Introductions.php:187 #: src/Module/Profile/Profile.php:221 msgid "Location:" @@ -2437,7 +2437,7 @@ msgstr "" #: src/Content/Widget/VCard.php:118 src/Model/Contact.php:1223 #: src/Model/Contact.php:1234 src/Model/Profile.php:463 -#: src/Module/Contact/Profile.php:477 +#: src/Module/Contact/Profile.php:469 msgid "Unfollow" msgstr "" @@ -3469,7 +3469,7 @@ msgstr "" msgid "Homepage:" msgstr "" -#: src/Model/Profile.php:375 src/Module/Contact/Profile.php:425 +#: src/Model/Profile.php:375 src/Module/Contact/Profile.php:418 #: src/Module/Notifications/Introductions.php:189 msgid "About:" msgstr "" @@ -6088,18 +6088,18 @@ msgstr "" msgid "Update" msgstr "" -#: src/Module/Contact.php:468 src/Module/Contact/Profile.php:525 +#: src/Module/Contact.php:468 src/Module/Contact/Profile.php:517 #: 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:469 src/Module/Contact/Profile.php:533 +#: src/Module/Contact.php:469 src/Module/Contact/Profile.php:525 msgid "Unignore" msgstr "" -#: src/Module/Contact.php:470 src/Module/Contact/Profile.php:541 +#: src/Module/Contact.php:470 src/Module/Contact/Profile.php:533 msgid "Uncollapse" msgstr "" @@ -6151,7 +6151,7 @@ msgstr "" msgid "Pending incoming contact request" msgstr "" -#: src/Module/Contact.php:627 src/Module/Contact/Profile.php:384 +#: src/Module/Contact.php:627 src/Module/Contact/Profile.php:377 #, php-format msgid "Visit %s's profile [%s]" msgstr "" @@ -6287,7 +6287,7 @@ msgstr "" msgid "Your Identity Address:" msgstr "" -#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:415 +#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:408 #: src/Module/Contact/Unfollow.php:129 #: src/Module/Moderation/Blocklist/Contact.php:133 #: src/Module/Moderation/Reports.php:104 @@ -6296,7 +6296,7 @@ msgstr "" msgid "Profile URL" msgstr "" -#: src/Module/Contact/Follow.php:171 src/Module/Contact/Profile.php:427 +#: src/Module/Contact/Follow.php:171 src/Module/Contact/Profile.php:420 #: src/Module/Notifications/Introductions.php:191 #: src/Module/Profile/Profile.php:234 msgid "Tags:" @@ -6398,7 +6398,7 @@ msgstr "" msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:290 src/Module/Contact/Profile.php:496 +#: src/Module/Contact/Profile.php:290 src/Module/Contact/Profile.php:488 msgid "Suggest friends" msgstr "" @@ -6452,174 +6452,197 @@ msgstr "" msgid "Channel Settings" msgstr "" -#: src/Module/Contact/Profile.php:347 -msgid "Default visibility" -msgstr "" - -#: src/Module/Contact/Profile.php:348 -msgid "Display all posts of this contact" -msgstr "" - -#: src/Module/Contact/Profile.php:349 -msgid "Display only few posts" -msgstr "" - -#: src/Module/Contact/Profile.php:350 -msgid "Never display posts from this contact" -msgstr "" - -#: src/Module/Contact/Profile.php:366 +#: src/Module/Contact/Profile.php:359 msgid "Contact Information / Notes" msgstr "" -#: src/Module/Contact/Profile.php:367 +#: src/Module/Contact/Profile.php:360 msgid "Contact Settings" msgstr "" -#: src/Module/Contact/Profile.php:375 +#: src/Module/Contact/Profile.php:368 msgid "Contact" msgstr "" -#: src/Module/Contact/Profile.php:379 +#: src/Module/Contact/Profile.php:372 msgid "Their personal note" msgstr "" -#: src/Module/Contact/Profile.php:381 +#: src/Module/Contact/Profile.php:374 msgid "Edit contact notes" msgstr "" -#: src/Module/Contact/Profile.php:385 +#: src/Module/Contact/Profile.php:378 msgid "Block/Unblock contact" msgstr "" -#: src/Module/Contact/Profile.php:386 +#: src/Module/Contact/Profile.php:379 #: src/Module/Moderation/Report/Create.php:293 msgid "Ignore contact" msgstr "" -#: src/Module/Contact/Profile.php:387 +#: src/Module/Contact/Profile.php:380 msgid "View conversations" msgstr "" -#: src/Module/Contact/Profile.php:392 +#: src/Module/Contact/Profile.php:385 msgid "Last update:" msgstr "" -#: src/Module/Contact/Profile.php:394 +#: src/Module/Contact/Profile.php:387 msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:396 src/Module/Contact/Profile.php:506 +#: src/Module/Contact/Profile.php:389 src/Module/Contact/Profile.php:498 msgid "Update now" msgstr "" -#: src/Module/Contact/Profile.php:398 +#: src/Module/Contact/Profile.php:391 msgid "Awaiting connection acknowledge" msgstr "" -#: src/Module/Contact/Profile.php:399 +#: src/Module/Contact/Profile.php:392 msgid "Currently blocked" msgstr "" -#: src/Module/Contact/Profile.php:400 +#: src/Module/Contact/Profile.php:393 msgid "Currently ignored" msgstr "" -#: src/Module/Contact/Profile.php:401 +#: src/Module/Contact/Profile.php:394 msgid "Currently collapsed" msgstr "" -#: src/Module/Contact/Profile.php:402 +#: src/Module/Contact/Profile.php:395 msgid "Currently archived" msgstr "" -#: src/Module/Contact/Profile.php:405 +#: src/Module/Contact/Profile.php:398 msgid "Manage remote servers" msgstr "" -#: src/Module/Contact/Profile.php:407 +#: src/Module/Contact/Profile.php:400 #: src/Module/Notifications/Introductions.php:192 msgid "Hide this contact from others" msgstr "" -#: src/Module/Contact/Profile.php:407 +#: src/Module/Contact/Profile.php:400 msgid "" "Replies/likes to your public posts may still be visible" msgstr "" -#: src/Module/Contact/Profile.php:408 +#: src/Module/Contact/Profile.php:401 msgid "Notification for new posts" msgstr "" -#: src/Module/Contact/Profile.php:408 +#: src/Module/Contact/Profile.php:401 msgid "Send a notification of every new post of this contact" msgstr "" -#: src/Module/Contact/Profile.php:410 +#: src/Module/Contact/Profile.php:403 msgid "Keyword Deny List" msgstr "" -#: src/Module/Contact/Profile.php:410 +#: src/Module/Contact/Profile.php:403 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:428 +#: src/Module/Contact/Profile.php:421 #: src/Module/Settings/TwoFactor/Index.php:139 msgid "Actions" msgstr "" -#: src/Module/Contact/Profile.php:430 +#: src/Module/Contact/Profile.php:423 #: src/Module/Settings/TwoFactor/Index.php:119 view/theme/frio/theme.php:229 msgid "Status" msgstr "" -#: src/Module/Contact/Profile.php:436 +#: src/Module/Contact/Profile.php:429 msgid "Mirror postings from this contact" msgstr "" -#: src/Module/Contact/Profile.php:438 +#: src/Module/Contact/Profile.php:431 msgid "" "Mark this contact as remote_self, this will cause friendica to repost new " "entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:444 -msgid "Visibility of this contact in appropriate channels" +#: src/Module/Contact/Profile.php:435 +msgid "Frequency of this contact in relevant channels" msgstr "" -#: src/Module/Contact/Profile.php:446 +#: src/Module/Contact/Profile.php:436 msgid "" -"Depending on the type of the channel not all posts from contacts are " -"displayed by default. They for example need to have a certain amount of " -"comments to be displayed. On the other hand there can be contacts who flood " -"the channel, so you might want to see only some of their posts. Or you don't " -"want to see their content at all, but you don't want to block or hide the " -"contact completely." +"Depending on the type of the channel not all posts from this contact are " +"displayed. By default, posts need to have a minimum amount of interactions " +"(comments, likes) to show in your channels. On the other hand there can be " +"contacts who flood the channel, so you might want to see only some of their " +"posts. Or you don't want to see their content at all, but you don't want to " +"block or hide the contact completely." msgstr "" -#: src/Module/Contact/Profile.php:516 +#: src/Module/Contact/Profile.php:437 +msgid "Default frequency" +msgstr "" + +#: src/Module/Contact/Profile.php:437 +msgid "" +"Posts by this contact are displayed in the \"for you\" channel if you " +"interact often with this contact or if a post reached some level of " +"interaction." +msgstr "" + +#: src/Module/Contact/Profile.php:438 +msgid "Display all posts of this contact" +msgstr "" + +#: src/Module/Contact/Profile.php:438 +msgid "" +"If you follow this contact, all their posts will appear on the \"for you\" " +"channel" +msgstr "" + +#: src/Module/Contact/Profile.php:439 +msgid "Display only few posts" +msgstr "" + +#: src/Module/Contact/Profile.php:439 +msgid "" +"When a contact creates a lot of posts in a short period, this setting " +"reduces the number of displayed posts in every channel." +msgstr "" + +#: src/Module/Contact/Profile.php:440 +msgid "Never display posts" +msgstr "" + +#: src/Module/Contact/Profile.php:440 +msgid "Posts from this contact will never be displayed in any channel" +msgstr "" + +#: src/Module/Contact/Profile.php:508 msgid "Refetch contact data" msgstr "" -#: src/Module/Contact/Profile.php:527 +#: src/Module/Contact/Profile.php:519 msgid "Toggle Blocked status" msgstr "" -#: src/Module/Contact/Profile.php:535 +#: src/Module/Contact/Profile.php:527 msgid "Toggle Ignored status" msgstr "" -#: src/Module/Contact/Profile.php:543 +#: src/Module/Contact/Profile.php:535 msgid "Toggle Collapsed status" msgstr "" -#: src/Module/Contact/Profile.php:550 src/Module/Contact/Revoke.php:106 +#: src/Module/Contact/Profile.php:542 src/Module/Contact/Revoke.php:106 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:552 +#: src/Module/Contact/Profile.php:544 msgid "Revoke the follow from this contact" msgstr "" @@ -6715,15 +6738,15 @@ msgstr "" msgid "Network feed not available." msgstr "" -#: src/Module/Conversation/Timeline.php:152 +#: src/Module/Conversation/Timeline.php:156 msgid "Own Contacts" msgstr "" -#: src/Module/Conversation/Timeline.php:156 +#: src/Module/Conversation/Timeline.php:160 msgid "Include" msgstr "" -#: src/Module/Conversation/Timeline.php:157 +#: src/Module/Conversation/Timeline.php:161 msgid "Hide" msgstr "" From aa6eb7fcf123a80835aa41e06ca123d17507768a Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 Sep 2023 04:20:38 +0000 Subject: [PATCH 09/20] Visiblity is now frequency --- database.sql | 11 +++++++---- doc/database/db_user-contact.md | 2 +- src/Model/Contact/User.php | 20 ++++++++++---------- src/Module/Contact/Profile.php | 20 ++++++++++---------- src/Module/Conversation/Channel.php | 1 + view/templates/contact_edit.tpl | 12 ++++++------ view/theme/frio/templates/contact_edit.tpl | 12 ++++++------ 7 files changed, 41 insertions(+), 37 deletions(-) diff --git a/database.sql b/database.sql index 131942c1f8..32fb258314 100644 --- a/database.sql +++ b/database.sql @@ -1572,6 +1572,9 @@ CREATE TABLE IF NOT EXISTS `post-thread-user` ( INDEX `psid` (`psid`), INDEX `post-user-id` (`post-user-id`), INDEX `commented` (`commented`), + INDEX `received` (`received`), + INDEX `wall` (`wall`), + INDEX `origin` (`origin`), INDEX `uid_received` (`uid`,`received`), INDEX `uid_wall_received` (`uid`,`wall`,`received`), INDEX `uid_commented` (`uid`,`commented`), @@ -1733,14 +1736,14 @@ CREATE TABLE IF NOT EXISTS `report` ( `cid` int unsigned NOT NULL COMMENT 'Reported contact', `gsid` int unsigned COMMENT 'Reported contact server', `comment` text COMMENT 'Report', - `category-id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Report category, one of Entity\Report::CATEGORY_*', + `category-id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Report category, one of Entity Report::CATEGORY_*', `forward` boolean COMMENT 'Forward the report to the remote server', `public-remarks` text COMMENT 'Remarks shared with the reporter', `private-remarks` text COMMENT 'Remarks shared with the moderation team', `last-editor-uid` mediumint unsigned COMMENT 'Last editor user', `assigned-uid` mediumint unsigned COMMENT 'Assigned moderator user', - `status` tinyint unsigned NOT NULL COMMENT 'Status of the report, one of Entity\Report::STATUS_*', - `resolution` tinyint unsigned COMMENT 'Resolution of the report, one of Entity\Report::RESOLUTION_*', + `status` tinyint unsigned NOT NULL COMMENT 'Status of the report, one of Entity Report::STATUS_*', + `resolution` tinyint unsigned COMMENT 'Resolution of the report, one of Entity Report::RESOLUTION_*', `created` datetime(6) NOT NULL DEFAULT '0001-01-01 00:00:00.000000' COMMENT '', `edited` datetime(6) COMMENT 'Last time the report has been edited', PRIMARY KEY(`id`), @@ -1866,7 +1869,7 @@ CREATE TABLE IF NOT EXISTS `user-contact` ( `collapsed` boolean COMMENT 'Posts from this contact are collapsed', `hidden` boolean COMMENT 'This contact is hidden from the others', `is-blocked` boolean COMMENT 'User is blocked by this contact', - `channel-visibility` tinyint unsigned COMMENT 'Controls the visibility in channels', + `channel-frequency` tinyint unsigned COMMENT 'Controls the frequency of the appearance of this contact in channels', `pending` boolean COMMENT '', `rel` tinyint unsigned COMMENT 'The kind of the relation between the user and the contact', `info` mediumtext COMMENT '', diff --git a/doc/database/db_user-contact.md b/doc/database/db_user-contact.md index 60b3c44b01..bfba9cb651 100644 --- a/doc/database/db_user-contact.md +++ b/doc/database/db_user-contact.md @@ -16,7 +16,7 @@ Fields | collapsed | Posts from this contact are collapsed | boolean | YES | | NULL | | | hidden | This contact is hidden from the others | boolean | YES | | NULL | | | is-blocked | User is blocked by this contact | boolean | YES | | NULL | | -| channel-visibility | Controls the visibility in channels | tinyint unsigned | YES | | NULL | | +| channel-frequency | Controls the frequency of the appearance of this contact in channels | tinyint unsigned | YES | | NULL | | | pending | | boolean | YES | | NULL | | | rel | The kind of the relation between the user and the contact | tinyint unsigned | YES | | NULL | | | info | | mediumtext | YES | | NULL | | diff --git a/src/Model/Contact/User.php b/src/Model/Contact/User.php index ff2f093cf4..da53aba7b7 100644 --- a/src/Model/Contact/User.php +++ b/src/Model/Contact/User.php @@ -37,10 +37,10 @@ use PDOException; */ class User { - const VISIBILITY_DEFAULT = 0; - const VISIBILITY_NEVER = 1; - const VISIBILITY_ALWAYS = 2; - const VISIBILITY_REDUCED = 3; + const FREQUENCY_DEFAULT = 0; + const FREQUENCY_NEVER = 1; + const FREQUENCY_ALWAYS = 2; + const FREQUENCY_REDUCED = 3; /** * Insert a user-contact for a given contact array * @@ -327,14 +327,14 @@ class User * @return void * @throws \Exception */ - public static function setChannelVisibility(int $cid, int $uid, int $visibility) + public static function setChannelFrequency(int $cid, int $uid, int $visibility) { $cdata = Contact::getPublicAndUserContactID($cid, $uid); if (empty($cdata)) { return; } - DBA::update('user-contact', ['channel-visibility' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true); + DBA::update('user-contact', ['channel-frequency' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true); } /** @@ -346,19 +346,19 @@ class User * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function getChannelVisibility(int $cid, int $uid): int + public static function getChannelFrequency(int $cid, int $uid): int { $cdata = Contact::getPublicAndUserContactID($cid, $uid); if (empty($cdata)) { return false; } - $visibility = self::VISIBILITY_DEFAULT; + $visibility = self::FREQUENCY_DEFAULT; if (!empty($cdata['public'])) { - $public_contact = DBA::selectFirst('user-contact', ['channel-visibility'], ['cid' => $cdata['public'], 'uid' => $uid]); + $public_contact = DBA::selectFirst('user-contact', ['channel-frequency'], ['cid' => $cdata['public'], 'uid' => $uid]); if (DBA::isResult($public_contact)) { - $visibility = $public_contact['channel-visibility'] ?? self::VISIBILITY_DEFAULT; + $visibility = $public_contact['channel-frequency'] ?? self::FREQUENCY_DEFAULT; } } diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index c28d48c92e..0fa39ed74e 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -132,8 +132,8 @@ class Profile extends BaseModule $fields['info'] = $_POST['info']; } - if (isset($_POST['channel_visibility'])) { - Contact\User::setChannelVisibility($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_visibility']); + if (isset($_POST['channel_frequency'])) { + Contact\User::setChannelFrequency($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_frequency']); } if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => $this->session->getLocalUserId()])) { @@ -342,10 +342,10 @@ class Profile extends BaseModule if (in_array($contact['network'], Protocol::FEDERATED)) { $channel_settings_label = $this->t('Channel Settings'); - $channel_visibility = Contact\User::getChannelVisibility($contact['id'], $this->session->getLocalUserId()); + $channel_frequency = Contact\User::getChannelFrequency($contact['id'], $this->session->getLocalUserId()); } else { $channel_settings_label = null; - $channel_visibility = null; + $channel_frequency = null; } $poll_interval = null; @@ -432,12 +432,12 @@ class Profile extends BaseModule $remote_self_options ], '$channel_settings_label' => $channel_settings_label, - '$visibility_label' => $this->t('Frequency of this contact in relevant channels'), - '$visibility_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), - '$visibility_default' => ['channel_visibility', $this->t('Default frequency'), Contact\User::VISIBILITY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT], - '$visibility_always' => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS], - '$visibility_reduced' => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED], - '$visibility_never' => ['channel_visibility', $this->t('Never display posts'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER], + '$frequency_label' => $this->t('Frequency of this contact in relevant channels'), + '$frequency_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), + '$frequency_default' => ['channel_frequency', $this->t('Default frequency'), Contact\User::FREQUENCY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_frequency == Contact\User::FREQUENCY_DEFAULT], + '$frequency_always' => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS], + '$frequency_reduced' => ['channel_frequency', $this->t('Display only few posts'), Contact\User::FREQUENCY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_frequency == Contact\User::FREQUENCY_REDUCED], + '$frequency_never' => ['channel_frequency', $this->t('Never display posts'), Contact\User::FREQUENCY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_frequency == Contact\User::FREQUENCY_NEVER], ]); $arr = ['contact' => $contact, 'output' => $o]; diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index 83ea662fd2..35c988ce7c 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -160,5 +160,6 @@ class Channel extends Timeline } $this->maxId = $request['last_created'] ?? $this->maxId; + $this->minId = $request['first_created'] ?? $this->minId; } } diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index f17743f765..38414fabe9 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -93,12 +93,12 @@ {{/if}} {{if $channel_settings_label}}

{{$channel_settings_label}}

- - {{include file="field_radio.tpl" field=$visibility_default}} - {{include file="field_radio.tpl" field=$visibility_always}} - {{include file="field_radio.tpl" field=$visibility_reduced}} - {{include file="field_radio.tpl" field=$visibility_never}} -

{{$visibility_description}}

+ + {{include file="field_radio.tpl" field=$frequency_default}} + {{include file="field_radio.tpl" field=$frequency_always}} + {{include file="field_radio.tpl" field=$frequency_reduced}} + {{include file="field_radio.tpl" field=$frequency_never}} +

{{$frequency_description}}

{{/if}}
diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index c9f8423602..237c4f4345 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -201,12 +201,12 @@
- - {{include file="field_radio.tpl" field=$visibility_default}} - {{include file="field_radio.tpl" field=$visibility_always}} - {{include file="field_radio.tpl" field=$visibility_reduced}} - {{include file="field_radio.tpl" field=$visibility_never}} -

{{$visibility_description}}

+ + {{include file="field_radio.tpl" field=$frequency_default}} + {{include file="field_radio.tpl" field=$frequency_always}} + {{include file="field_radio.tpl" field=$frequency_reduced}} + {{include file="field_radio.tpl" field=$frequency_never}} +

{{$frequency_description}}

From e038890bb7177b9c1bdcc747a7991aaf476552fa Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 Sep 2023 04:21:59 +0000 Subject: [PATCH 10/20] Fix the erratic page update behaviour --- doc/database/db_post-thread-user.md | 3 + doc/database/db_report.md | 6 +- src/Database/DBStructure.php | 4 +- src/Module/Conversation/Community.php | 9 +-- src/Module/Conversation/Network.php | 14 ++++- src/Module/Conversation/Timeline.php | 81 +++++++++++++++++---------- static/dbstructure.config.php | 11 ++-- view/js/main.js | 20 +++++++ view/lang/C/messages.po | 8 +-- 9 files changed, 107 insertions(+), 49 deletions(-) diff --git a/doc/database/db_post-thread-user.md b/doc/database/db_post-thread-user.md index 9026370491..e29148c4b3 100644 --- a/doc/database/db_post-thread-user.md +++ b/doc/database/db_post-thread-user.md @@ -49,6 +49,9 @@ Indexes | psid | psid | | post-user-id | post-user-id | | commented | commented | +| received | received | +| wall | wall | +| origin | origin | | uid_received | uid, received | | uid_wall_received | uid, wall, received | | uid_commented | uid, commented | diff --git a/doc/database/db_report.md b/doc/database/db_report.md index cae4a2f33b..7157224314 100644 --- a/doc/database/db_report.md +++ b/doc/database/db_report.md @@ -14,14 +14,14 @@ Fields | cid | Reported contact | int unsigned | NO | | NULL | | | gsid | Reported contact server | int unsigned | YES | | NULL | | | comment | Report | text | YES | | NULL | | -| category-id | Report category, one of Entity\Report::CATEGORY_* | int unsigned | NO | | 1 | | +| category-id | Report category, one of Entity Report::CATEGORY_* | int unsigned | NO | | 1 | | | forward | Forward the report to the remote server | boolean | YES | | NULL | | | public-remarks | Remarks shared with the reporter | text | YES | | NULL | | | private-remarks | Remarks shared with the moderation team | text | YES | | NULL | | | last-editor-uid | Last editor user | mediumint unsigned | YES | | NULL | | | assigned-uid | Assigned moderator user | mediumint unsigned | YES | | NULL | | -| status | Status of the report, one of Entity\Report::STATUS_* | tinyint unsigned | NO | | NULL | | -| resolution | Resolution of the report, one of Entity\Report::RESOLUTION_* | tinyint unsigned | YES | | NULL | | +| status | Status of the report, one of Entity Report::STATUS_* | tinyint unsigned | NO | | NULL | | +| resolution | Resolution of the report, one of Entity Report::RESOLUTION_* | tinyint unsigned | YES | | NULL | | | created | | datetime(6) | NO | | 0001-01-01 00:00:00.000000 | | | edited | Last time the report has been edited | datetime(6) | YES | | NULL | | diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 6ac52ea9c3..6291d0ffc4 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -284,7 +284,7 @@ class DBStructure echo $sql; } if ($action) { - $r = DBA::e(str_replace('\\', '\\\\', $sql)); + $r = DBA::e($sql); if (!DBA::isResult($r)) { $errors .= self::printUpdateError($name); } @@ -493,7 +493,7 @@ class DBStructure DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name)); } - $r = DBA::e(str_replace('\\', '\\\\', $sql3)); + $r = DBA::e($sql3); if (!DBA::isResult($r)) { $errors .= self::printUpdateError($sql3); } diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index 8e0782cf5d..42f5620967 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -126,13 +126,13 @@ class Community extends Timeline return $o; } - $o .= $this->conversation->render($items, Conversation::MODE_COMMUNITY, false, false, 'commented', $this->session->getLocalUserId()); + $o .= $this->conversation->render($items, Conversation::MODE_COMMUNITY, false, false, 'received', $this->session->getLocalUserId()); $pager = new BoundariesPager( $this->l10n, $this->args->getQueryString(), - $items[0]['commented'], - $items[count($items) - 1]['commented'], + $items[0]['received'], + $items[count($items) - 1]['received'], $this->itemsPerPage ); @@ -196,6 +196,7 @@ class Community extends Timeline } } - $this->maxId = $request['last_commented'] ?? $this->maxId; + $this->maxId = $request['last_received'] ?? $this->maxId; + $this->minId = $request['first_received'] ?? $this->minId; } } diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 8041a3309f..3850fccf86 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -292,7 +292,7 @@ class Network extends Timeline if (!empty($network_timelines)) { $tabs = []; - + foreach (array_keys($arr['tabs']) as $tab) { if (in_array($tab, $network_timelines)) { $tabs[] = $arr['tabs'][$tab]; @@ -340,7 +340,7 @@ class Network extends Timeline $this->order = $request['order']; $this->star = false; $this->mention = false; - } elseif (in_array($this->selectedTab, [TimelineEntity::RECEIVED, TimelineEntity::STAR])) { + } elseif (in_array($this->selectedTab, [TimelineEntity::RECEIVED, TimelineEntity::STAR]) || $this->timeline->isCommunity($this->selectedTab)) { $this->order = 'received'; } elseif (($this->selectedTab == TimelineEntity::CREATED) || $this->timeline->isChannel($this->selectedTab)) { $this->order = 'created'; @@ -348,6 +348,12 @@ class Network extends Timeline $this->order = 'commented'; } + // Upon force (updates in the background) and order by last comment we order by receive date, + // since otherwise the feed will optically jump, when some already visible thread has been updated. + if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED)) { + $this->order = 'received'; + } + $this->selectedTab = $this->selectedTab ?? $this->order; // Prohibit combined usage of "star" and "mention" @@ -368,16 +374,20 @@ class Network extends Timeline switch ($this->order) { case 'received': $this->maxId = $request['last_received'] ?? $this->maxId; + $this->minId = $request['first_received'] ?? $this->minId; break; case 'created': $this->maxId = $request['last_created'] ?? $this->maxId; + $this->minId = $request['first_created'] ?? $this->minId; break; case 'uriid': $this->maxId = $request['last_uriid'] ?? $this->maxId; + $this->minId = $request['first_uriid'] ?? $this->minId; break; default: $this->order = 'commented'; $this->maxId = $request['last_commented'] ?? $this->maxId; + $this->minId = $request['first_commented'] ?? $this->minId; } } diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index 5ee5a7b674..ac67be9574 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -62,6 +62,8 @@ class Timeline extends BaseModule protected $itemsPerPage; /** @var bool */ protected $noSharer; + /** @var bool */ + protected $force; /** @var App\Mode $mode */ protected $mode; @@ -129,6 +131,7 @@ class Timeline extends BaseModule $this->maxId = $request['max_id'] ?? null; $this->noSharer = !empty($request['no_sharer']); + $this->force = !empty($request['force']); } protected function getNoSharerWidget(string $base): string @@ -191,31 +194,47 @@ class Timeline extends BaseModule { $items = $this->getRawChannelItems(); - $contacts = $this->database->selectToArray('user-contact', ['cid'], ['channel-visibility' => Contact\User::VISIBILITY_REDUCED, 'cid' => array_column($items, 'owner-id')]); + $contacts = $this->database->selectToArray('user-contact', ['cid'], ['channel-frequency' => Contact\User::FREQUENCY_REDUCED, 'cid' => array_column($items, 'owner-id')]); $reduced = array_column($contacts, 'cid'); $maxpostperauthor = $this->config->get('channel', 'max_posts_per_author'); if ($maxpostperauthor != 0) { $count = 1; - $numposts = []; + $owner_posts = []; $selected_items = []; while (count($selected_items) < $this->itemsPerPage && ++$count < 50 && count($items) > 0) { + $maxposts = round((count($items) / $this->itemsPerPage) * $maxpostperauthor); + $minId = $items[array_key_first($items)]['created']; + $maxId = $items[array_key_last($items)]['created']; + foreach ($items as $item) { - $numposts[$item['owner-id']] = ($numposts[$item['owner-id']] ?? 0); - if (!in_array($item['owner-id'], $reduced) || (($numposts[$item['owner-id']]++ < $maxpostperauthor)) && (count($selected_items) < $this->itemsPerPage)) { - $selected_items[] = $item; + if (!in_array($item['owner-id'], $reduced)) { + continue; + } + $owner_posts[$item['owner-id']][$item['uri-id']] = (($item['comments'] * 100) + $item['activities']); + } + foreach ($owner_posts as $posts) { + if (count($posts) <= $maxposts) { + continue; + } + asort($posts); + while (count($posts) > $maxposts) { + $uri_id = array_key_first($posts); + unset($posts[$uri_id]); + unset($items[$uri_id]); } } + $selected_items = array_merge($selected_items, $items); // If we're looking at a "previous page", the lookup continues forward in time because the list is // sorted in chronologically decreasing order - if (isset($this->minId)) { - $this->minId = $items[0]['created']; + if (!empty($this->minId)) { + $this->minId = $minId; } else { // In any other case, the lookup continues backwards in time - $this->maxId = $items[count($items) - 1]['created']; + $this->maxId = $maxId; } if (count($selected_items) < $this->itemsPerPage) { @@ -254,9 +273,9 @@ class Timeline extends BaseModule $condition = [ "(`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `relation-thread-score` > ?) OR ((`comments` >= ? OR `activities` >= ?) AND `owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `follows` AND `relation-cid` = ?)) OR - (`owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`notify_new_posts` OR `channel-visibility` = ?))))", + (`owner-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`notify_new_posts` OR `channel-frequency` = ?))))", $cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid, - $uid, Contact\User::VISIBILITY_ALWAYS + $uid, Contact\User::FREQUENCY_ALWAYS ]; } elseif ($this->selectedTab == TimelineEntity::FOLLOWERS) { $condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER]; @@ -284,7 +303,7 @@ class Timeline extends BaseModule $condition = $this->addLanguageCondition($uid, $condition); } - $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed` OR `is-blocked` OR `channel-visibility` = ?))", $uid, Contact\User::VISIBILITY_NEVER]); + $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed` OR `is-blocked` OR `channel-frequency` = ?))", $uid, Contact\User::FREQUENCY_NEVER]); if (($this->selectedTab != TimelineEntity::WHATSHOT) && !is_null($this->accountType)) { $condition = DBA::mergeConditions($condition, ['contact-type' => $this->accountType]); @@ -313,14 +332,20 @@ class Timeline extends BaseModule } } - $items = $this->database->selectToArray('post-engagement', ['uri-id', 'created', 'owner-id'], $condition, $params); + $items = []; + $result = $this->database->select('post-engagement', ['uri-id', 'created', 'owner-id', 'comments', 'activities'], $condition, $params); + while ($item = $this->database->fetch($result)) { + $items[$item['uri-id']] = $item; + } + $this->database->close($result); + if (empty($items)) { return []; } // Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) { - $items = array_reverse($items); + $items = array_reverse($items, true); } $condition = ['unseen' => true, 'uid' => $uid, 'parent-uri-id' => array_column($items, 'uri-id')]; @@ -451,10 +476,10 @@ class Timeline extends BaseModule // If we're looking at a "previous page", the lookup continues forward in time because the list is // sorted in chronologically decreasing order if (isset($this->minId)) { - $this->minId = $items[0]['commented']; + $this->minId = $items[0]['received']; } else { // In any other case, the lookup continues backwards in time - $this->maxId = $items[count($items) - 1]['commented']; + $this->maxId = $items[count($items) - 1]['received']; } $items = $this->selectItems(); @@ -479,22 +504,18 @@ class Timeline extends BaseModule private function selectItems() { if ($this->selectedTab == 'local') { - if (!is_null($this->accountType)) { - $condition = ["`wall` AND `origin` AND `private` = ? AND `owner-contact-type` = ?", Item::PUBLIC, $this->accountType]; - } else { - $condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC]; - } + $condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC]; } elseif ($this->selectedTab == 'global') { - if (!is_null($this->accountType)) { - $condition = ["`uid` = ? AND `private` = ? AND `owner-contact-type` = ?", 0, Item::PUBLIC, $this->accountType]; - } else { - $condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC]; - } + $condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC]; } else { return []; } - $params = ['order' => ['commented' => true], 'limit' => $this->itemsPerPage]; + if (!is_null($this->accountType)) { + $condition = DBA::mergeConditions($condition, ['owner-contact-type' => $this->accountType]); + } + + $params = ['order' => ['received' => true], 'limit' => $this->itemsPerPage]; if (!empty($this->itemUriId)) { $condition = DBA::mergeConditions($condition, ['uri-id' => $this->itemUriId]); @@ -504,20 +525,20 @@ class Timeline extends BaseModule } if (isset($this->maxId)) { - $condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->maxId]); + $condition = DBA::mergeConditions($condition, ["`received` < ?", $this->maxId]); } if (isset($this->minId)) { - $condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->minId]); + $condition = DBA::mergeConditions($condition, ["`received` > ?", $this->minId]); // Previous page case: we want the items closest to min_id but for that we need to reverse the query order if (!isset($this->maxId)) { - $params['order']['commented'] = false; + $params['order']['received'] = false; } } } - $r = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'commented', 'author-link'], $condition, $params); + $r = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'received', 'author-link'], $condition, $params); $items = Post::toArray($r); if (empty($items)) { diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index a2f392c785..17f3fbdc10 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -1578,6 +1578,9 @@ return [ "psid" => ["psid"], "post-user-id" => ["post-user-id"], "commented" => ["commented"], + "received" => ["received"], + "wall" => ["wall"], + "origin" => ["origin"], "uid_received" => ["uid", "received"], "uid_wall_received" => ["uid", "wall", "received"], "uid_commented" => ["uid", "commented"], @@ -1728,14 +1731,14 @@ return [ "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => "Reported contact"], "gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id"], "comment" => "Reported contact server"], "comment" => ["type" => "text", "comment" => "Report"], - "category-id" => ["type" => "int unsigned", "not null" => 1, "default" => \Friendica\Moderation\Entity\Report::CATEGORY_OTHER, "comment" => "Report category, one of Entity\Report::CATEGORY_*"], + "category-id" => ["type" => "int unsigned", "not null" => 1, "default" => \Friendica\Moderation\Entity\Report::CATEGORY_OTHER, "comment" => "Report category, one of Entity Report::CATEGORY_*"], "forward" => ["type" => "boolean", "comment" => "Forward the report to the remote server"], "public-remarks" => ["type" => "text", "comment" => "Remarks shared with the reporter"], "private-remarks" => ["type" => "text", "comment" => "Remarks shared with the moderation team"], "last-editor-uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Last editor user"], "assigned-uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Assigned moderator user"], - "status" => ["type" => "tinyint unsigned", "not null" => "1", "comment" => "Status of the report, one of Entity\Report::STATUS_*"], - "resolution" => ["type" => "tinyint unsigned", "comment" => "Resolution of the report, one of Entity\Report::RESOLUTION_*"], + "status" => ["type" => "tinyint unsigned", "not null" => "1", "comment" => "Status of the report, one of Entity Report::STATUS_*"], + "resolution" => ["type" => "tinyint unsigned", "comment" => "Resolution of the report, one of Entity Report::RESOLUTION_*"], "created" => ["type" => "datetime(6)", "not null" => "1", "default" => DBA::NULL_DATETIME6, "comment" => ""], "edited" => ["type" => "datetime(6)", "comment" => "Last time the report has been edited"], ], @@ -1857,7 +1860,7 @@ return [ "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"], "hidden" => ["type" => "boolean", "comment" => "This contact is hidden from the others"], "is-blocked" => ["type" => "boolean", "comment" => "User is blocked by this contact"], - "channel-visibility" => ["type" => "tinyint unsigned", "comment" => "Controls the visibility in channels"], + "channel-frequency" => ["type" => "tinyint unsigned", "comment" => "Controls the frequency of the appearance of this contact in channels"], "pending" => ["type" => "boolean", "comment" => ""], "rel" => ["type" => "tinyint unsigned", "comment" => "The kind of the relation between the user and the contact"], "info" => ["type" => "mediumtext", "comment" => ""], diff --git a/view/js/main.js b/view/js/main.js index c1a1ea7fd8..6a7874a1e2 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -608,6 +608,26 @@ function liveUpdate(src) { update_url += '&max_id=' + getUrlParameter('max_id'); } + match = $("span.received").first(); + if (match.length > 0) { + update_url += '&first_received=' + match[0].innerHTML; + } + + match = $("span.created").first(); + if (match.length > 0) { + update_url += '&first_created=' + match[0].innerHTML; + } + + match = $("span.commented").first(); + if (match.length > 0) { + update_url += '&first_commented=' + match[0].innerHTML; + } + + match = $("span.uriid").first(); + if (match.length > 0) { + update_url += '&first_uriid=' + match[0].innerHTML; + } + $.get(update_url, function(data) { in_progress = false; update_item = 0; diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 5c1470b57a..15a68da18e 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-15 19:05+0000\n" +"POT-Creation-Date: 2023-09-16 04:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -6738,15 +6738,15 @@ msgstr "" msgid "Network feed not available." msgstr "" -#: src/Module/Conversation/Timeline.php:156 +#: src/Module/Conversation/Timeline.php:155 msgid "Own Contacts" msgstr "" -#: src/Module/Conversation/Timeline.php:160 +#: src/Module/Conversation/Timeline.php:159 msgid "Include" msgstr "" -#: src/Module/Conversation/Timeline.php:161 +#: src/Module/Conversation/Timeline.php:160 msgid "Hide" msgstr "" From e731ea58d5ba60d2825d139b5e0494a6e146505e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 Sep 2023 04:23:44 +0000 Subject: [PATCH 11/20] Remove unneeded indexes --- database.sql | 2 -- doc/database/db_post-thread-user.md | 2 -- static/dbstructure.config.php | 2 -- 3 files changed, 6 deletions(-) diff --git a/database.sql b/database.sql index 32fb258314..2eec6fb809 100644 --- a/database.sql +++ b/database.sql @@ -1573,8 +1573,6 @@ CREATE TABLE IF NOT EXISTS `post-thread-user` ( INDEX `post-user-id` (`post-user-id`), INDEX `commented` (`commented`), INDEX `received` (`received`), - INDEX `wall` (`wall`), - INDEX `origin` (`origin`), INDEX `uid_received` (`uid`,`received`), INDEX `uid_wall_received` (`uid`,`wall`,`received`), INDEX `uid_commented` (`uid`,`commented`), diff --git a/doc/database/db_post-thread-user.md b/doc/database/db_post-thread-user.md index e29148c4b3..e4f5e39bda 100644 --- a/doc/database/db_post-thread-user.md +++ b/doc/database/db_post-thread-user.md @@ -50,8 +50,6 @@ Indexes | post-user-id | post-user-id | | commented | commented | | received | received | -| wall | wall | -| origin | origin | | uid_received | uid, received | | uid_wall_received | uid, wall, received | | uid_commented | uid, commented | diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 17f3fbdc10..89e234e7e9 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -1579,8 +1579,6 @@ return [ "post-user-id" => ["post-user-id"], "commented" => ["commented"], "received" => ["received"], - "wall" => ["wall"], - "origin" => ["origin"], "uid_received" => ["uid", "received"], "uid_wall_received" => ["uid", "wall", "received"], "uid_commented" => ["uid", "commented"], From 04e47660f41fd8b1aa1e0276c80b7da47a454951 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 Sep 2023 04:29:13 +0000 Subject: [PATCH 12/20] Adapt the description to the behaviour of this option --- src/Module/Contact/Profile.php | 2 +- view/lang/C/messages.po | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index 0fa39ed74e..cfb56ac4f7 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -435,7 +435,7 @@ class Profile extends BaseModule '$frequency_label' => $this->t('Frequency of this contact in relevant channels'), '$frequency_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."), '$frequency_default' => ['channel_frequency', $this->t('Default frequency'), Contact\User::FREQUENCY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_frequency == Contact\User::FREQUENCY_DEFAULT], - '$frequency_always' => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS], + '$frequency_always' => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('All posts from this contact will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS], '$frequency_reduced' => ['channel_frequency', $this->t('Display only few posts'), Contact\User::FREQUENCY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_frequency == Contact\User::FREQUENCY_REDUCED], '$frequency_never' => ['channel_frequency', $this->t('Never display posts'), Contact\User::FREQUENCY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_frequency == Contact\User::FREQUENCY_NEVER], ]); diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 15a68da18e..e41b176bf2 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-16 04:18+0000\n" +"POT-Creation-Date: 2023-09-16 04:28+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -6599,9 +6599,7 @@ msgid "Display all posts of this contact" msgstr "" #: src/Module/Contact/Profile.php:438 -msgid "" -"If you follow this contact, all their posts will appear on the \"for you\" " -"channel" +msgid "All posts from this contact will appear on the \"for you\" channel" msgstr "" #: src/Module/Contact/Profile.php:439 From bb4ec093ad5c7f93c4cf2c512b8836069a15f85c Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 16 Sep 2023 08:03:50 +0000 Subject: [PATCH 13/20] Indention fixed --- src/Module/Contact/Profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index cfb56ac4f7..d9faed7d97 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -438,7 +438,7 @@ class Profile extends BaseModule '$frequency_always' => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('All posts from this contact will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS], '$frequency_reduced' => ['channel_frequency', $this->t('Display only few posts'), Contact\User::FREQUENCY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_frequency == Contact\User::FREQUENCY_REDUCED], '$frequency_never' => ['channel_frequency', $this->t('Never display posts'), Contact\User::FREQUENCY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_frequency == Contact\User::FREQUENCY_NEVER], - ]); + ]); $arr = ['contact' => $contact, 'output' => $o]; From 02084331e3382cc127963e701d927b50ad5b994d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 05:43:36 +0000 Subject: [PATCH 14/20] Only change order for updates for new posts --- src/Module/Conversation/Network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 3850fccf86..63da5717ad 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -350,7 +350,7 @@ class Network extends Timeline // Upon force (updates in the background) and order by last comment we order by receive date, // since otherwise the feed will optically jump, when some already visible thread has been updated. - if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED)) { + if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED) && !empty($request['first_commented'])) { $this->order = 'received'; } From e81c911b4958f9cced860ce00e04358a58ee66af Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 05:57:44 +0000 Subject: [PATCH 15/20] Use class variables --- src/Module/Update/Channel.php | 2 +- src/Module/Update/Community.php | 2 +- src/Module/Update/Network.php | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Module/Update/Channel.php b/src/Module/Update/Channel.php index a9d7ce751f..223666739b 100644 --- a/src/Module/Update/Channel.php +++ b/src/Module/Update/Channel.php @@ -37,7 +37,7 @@ class Channel extends ChannelModule $this->parseRequest($request); $o = ''; - if (!empty($request['force'])) { + if ($this->force) { if ($this->timeline->isChannel($this->selectedTab)) { $items = $this->getChannelItems(); } else { diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index 88467f252a..31f75d24e2 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -39,7 +39,7 @@ class Community extends CommunityModule $this->parseRequest($request); $o = ''; - if (!empty($request['force'])) { + if ($this->force) { $o = DI::conversation()->render($this->getCommunityItems(), Conversation::MODE_COMMUNITY, true, false, 'commented', DI::userSession()->getLocalUserId()); } diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index ebd7211af0..5f7f234e04 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -35,11 +35,9 @@ class Network extends NetworkModule $this->parseRequest($request); - $profile_uid = intval($request['p']); - $o = ''; - if (empty($request['force'])) { + if (!$this->force) { System::htmlUpdateExit($o); } @@ -51,7 +49,7 @@ class Network extends NetworkModule $items = $this->getItems(); } - $o = $this->conversation->render($items, Conversation::MODE_NETWORK, $profile_uid, false, $this->getOrder(), $this->session->getLocalUserId()); + $o = $this->conversation->render($items, Conversation::MODE_NETWORK, true, false, $this->getOrder(), $this->session->getLocalUserId()); System::htmlUpdateExit($o); } From f1fa1f0b6290c14032db48d3084846e2ddd1bc19 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 08:17:31 +0000 Subject: [PATCH 16/20] Further improvements to the automatic update process --- src/Module/Conversation/Network.php | 4 ++-- src/Module/Conversation/Timeline.php | 5 ++++- src/Module/Update/Channel.php | 2 +- src/Module/Update/Community.php | 2 +- src/Module/Update/Network.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 63da5717ad..1d6dc86c35 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -348,9 +348,9 @@ class Network extends Timeline $this->order = 'commented'; } - // Upon force (updates in the background) and order by last comment we order by receive date, + // Upon updates in the background and order by last comment we order by receive date, // since otherwise the feed will optically jump, when some already visible thread has been updated. - if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED) && !empty($request['first_commented'])) { + if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) { $this->order = 'received'; } diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index ac67be9574..d685013ba4 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -64,6 +64,8 @@ class Timeline extends BaseModule protected $noSharer; /** @var bool */ protected $force; + /** @var bool */ + protected $update; /** @var App\Mode $mode */ protected $mode; @@ -131,7 +133,8 @@ class Timeline extends BaseModule $this->maxId = $request['max_id'] ?? null; $this->noSharer = !empty($request['no_sharer']); - $this->force = !empty($request['force']); + $this->force = !empty($request['force']) && !empty($request['item']); + $this->update = !empty($request['force']) && !empty($request['first_received']) && !empty($request['first_created']) && !empty($request['first_uriid']) && !empty($request['first_commented']); } protected function getNoSharerWidget(string $base): string diff --git a/src/Module/Update/Channel.php b/src/Module/Update/Channel.php index 223666739b..ac35d9c26b 100644 --- a/src/Module/Update/Channel.php +++ b/src/Module/Update/Channel.php @@ -37,7 +37,7 @@ class Channel extends ChannelModule $this->parseRequest($request); $o = ''; - if ($this->force) { + if ($this->update || $this->force) { if ($this->timeline->isChannel($this->selectedTab)) { $items = $this->getChannelItems(); } else { diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index 31f75d24e2..05ea8f828c 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -39,7 +39,7 @@ class Community extends CommunityModule $this->parseRequest($request); $o = ''; - if ($this->force) { + if ($this->update || $this->force) { $o = DI::conversation()->render($this->getCommunityItems(), Conversation::MODE_COMMUNITY, true, false, 'commented', DI::userSession()->getLocalUserId()); } diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index 5f7f234e04..e8a2dce07d 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -37,7 +37,7 @@ class Network extends NetworkModule $o = ''; - if (!$this->force) { + if (!$this->update && !$this->force) { System::htmlUpdateExit($o); } From 371309e775c03cbcde2731881f05e3d1be394bd9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 10:09:07 +0000 Subject: [PATCH 17/20] Use unified sidebar elements --- src/Module/Conversation/Network.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 1d6dc86c35..dcaeac8d2d 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -130,32 +130,28 @@ class Network extends Timeline $this->page['aside'] .= $this->getNoSharerWidget($module); } - if (Feature::isEnabled($this->session->getLocalUserId(), 'trending_tags')) { - $this->page['aside'] .= TrendingTags::getHTML($this->selectedTab); - } - $items = $this->getChannelItems(); } elseif ($this->timeline->isCommunity($this->selectedTab)) { if ($this->session->getLocalUserId() && $this->config->get('system', 'community_no_sharer')) { $this->page['aside'] .= $this->getNoSharerWidget($module); } - if (Feature::isEnabled($this->session->getLocalUserId(), 'trending_tags')) { - $this->page['aside'] .= TrendingTags::getHTML($this->selectedTab); - } - $items = $this->getCommunityItems(); } else { - $this->page['aside'] .= Circle::sidebarWidget($module, $module . '/circle', 'standard', $this->circleId); - $this->page['aside'] .= GroupManager::widget($module . '/group', $this->session->getLocalUserId(), $this->groupContactId); - $this->page['aside'] .= Widget::postedByYear($module . '/archive', $this->session->getLocalUserId(), false); - $this->page['aside'] .= Widget::networks($module, !$this->groupContactId ? $this->network : ''); - $this->page['aside'] .= Widget\SavedSearches::getHTML($this->args->getQueryString()); - $this->page['aside'] .= Widget::fileAs('filed', ''); - $items = $this->getItems(); } + $this->page['aside'] .= Circle::sidebarWidget($module, $module . '/circle', 'standard', $this->circleId); + $this->page['aside'] .= GroupManager::widget($module . '/group', $this->session->getLocalUserId(), $this->groupContactId); + $this->page['aside'] .= Widget::postedByYear($module . '/archive', $this->session->getLocalUserId(), false); + $this->page['aside'] .= Widget::networks($module, !$this->groupContactId ? $this->network : ''); + $this->page['aside'] .= Widget\SavedSearches::getHTML($this->args->getQueryString()); + $this->page['aside'] .= Widget::fileAs('filed', ''); + + if (Feature::isEnabled($this->session->getLocalUserId(), 'trending_tags')) { + $this->page['aside'] .= TrendingTags::getHTML($this->selectedTab); + } + if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal') { $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); $o .= Renderer::replaceMacros($tpl, ['$reload_uri' => $this->args->getQueryString()]); From e96bb4c5e6ba3fa3c0ab89ee9bdfa60fe24164cb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 11:01:04 +0000 Subject: [PATCH 18/20] Use "received" as tab for circles or groups when currently in a channel --- src/Module/Conversation/Network.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index dcaeac8d2d..a0a635ad6a 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -317,6 +317,10 @@ class Network extends Timeline throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.')); } + if (($this->network || $this->circleId || $this->groupContactId) && ($this->timeline->isChannel($this->selectedTab) || $this->timeline->isCommunity($this->selectedTab))) { + $this->selectedTab = TimelineEntity::RECEIVED; + } + if (!empty($request['star'])) { $this->selectedTab = TimelineEntity::STAR; $this->star = true; From ae3925bba527daf90d67dcd787bc7802dbddba31 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 17:42:15 +0000 Subject: [PATCH 19/20] Visibility is frequency --- src/Model/Contact/User.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Model/Contact/User.php b/src/Model/Contact/User.php index da53aba7b7..651c4d005a 100644 --- a/src/Model/Contact/User.php +++ b/src/Model/Contact/User.php @@ -319,30 +319,30 @@ class User } /** - * Set the channel visibility for contact id and user id + * Set the channel post frequency for contact id and user id * - * @param int $cid Either public contact id or user's contact id - * @param int $uid User ID - * @param int $visibility Set type of visibility + * @param int $cid Either public contact id or user's contact id + * @param int $uid User ID + * @param int $frequency Type of post frequency in channels * @return void * @throws \Exception */ - public static function setChannelFrequency(int $cid, int $uid, int $visibility) + public static function setChannelFrequency(int $cid, int $uid, int $frequency) { $cdata = Contact::getPublicAndUserContactID($cid, $uid); if (empty($cdata)) { return; } - DBA::update('user-contact', ['channel-frequency' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true); + DBA::update('user-contact', ['channel-frequency' => $frequency], ['cid' => $cdata['public'], 'uid' => $uid], true); } /** - * Returns the channel visibility state for contact id and user id + * Returns the channel frequency state for contact id and user id * * @param int $cid Either public contact id or user's contact id * @param int $uid User ID - * @return int the type of visibility in channels + * @return int Type of post frequency in channels * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -353,16 +353,16 @@ class User return false; } - $visibility = self::FREQUENCY_DEFAULT; + $frequency = self::FREQUENCY_DEFAULT; if (!empty($cdata['public'])) { $public_contact = DBA::selectFirst('user-contact', ['channel-frequency'], ['cid' => $cdata['public'], 'uid' => $uid]); if (DBA::isResult($public_contact)) { - $visibility = $public_contact['channel-frequency'] ?? self::FREQUENCY_DEFAULT; + $frequency = $public_contact['channel-frequency'] ?? self::FREQUENCY_DEFAULT; } } - return $visibility; + return $frequency; } /** From a1f6e6e8710e208c1eeb24618fa87a0aadc89422 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 17:44:33 +0000 Subject: [PATCH 20/20] Fix "received" --- src/Module/Conversation/Network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index a0a635ad6a..21ead331f0 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -348,7 +348,7 @@ class Network extends Timeline $this->order = 'commented'; } - // Upon updates in the background and order by last comment we order by receive date, + // Upon updates in the background and order by last comment we order by received date, // since otherwise the feed will optically jump, when some already visible thread has been updated. if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) { $this->order = 'received';