]> git.mxchange.org Git - friendica.git/commitdiff
New channel option "discover"
authorMichael <heluecht@pirati.ca>
Thu, 25 Jan 2024 10:50:28 +0000 (10:50 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 25 Jan 2024 10:50:28 +0000 (10:50 +0000)
doc/Channels.md
src/Content/Conversation/Entity/Channel.php
src/Content/Conversation/Factory/Channel.php
src/Module/Conversation/Channel.php
src/Module/Conversation/Timeline.php
view/lang/C/messages.po

index 5c206c7896b425cf30c0508f48eb3262f6e48834..02df7023e84accd0e10410553d9cb5478b82b9a5 100644 (file)
@@ -25,6 +25,10 @@ Predefined Channels
     * Posts from people you interact with on a more than average level.
     * Posts from the accounts that you follow with a more than average number of interactions-
     * Posts from accounts where you activated "notify on new posts" or where you have set the channel frequency accordingly.
+* Discover: Posts from contacts you don't follow, but that might be of interest for you to follow. In detail, it consists of:
+    * Posts from people you don't follow but you interact with on a more than average level.
+    * Posts from people you don't follow but that interact with you on a more than average level.
+    * Popular posts from people you don't follow but you interacted with or who interacted with you on any level.
 * What's Hot: Posts with a more than average number of interactions.
 * Language: Posts in your language.
 * Followers: Posts from your followers that you don't follow.
index fc839b495e42ae541121f8d46313ba3176f7d7ff..39b980130d6517a9461e10b05942687f784968c9 100644 (file)
@@ -25,6 +25,7 @@ class Channel extends Timeline
 {
        const WHATSHOT         = 'whatshot';
        const FORYOU           = 'foryou';
+       const DISCOVER         = 'discover';
        const FOLLOWERS        = 'followers';
        const SHARERSOFSHARERS = 'sharersofsharers';
        const IMAGE            = 'image';
index f5dc943578eb8e7981d1f0c931160b7db98f75d6..68ee8c4964e5406f9bee35f457f16fb2c25132b4 100644 (file)
@@ -40,6 +40,7 @@ final class Channel extends Timeline
 
                $tabs = [
                        new ChannelEntity(ChannelEntity::FORYOU, $this->l10n->t('For you'), $this->l10n->t('Posts from contacts you interact with and who interact with you'), 'y'),
+                       new ChannelEntity(ChannelEntity::DISCOVER, $this->l10n->t('Discover'), $this->l10n->t('Posts from accounts that you don\'t follow, but that you might like.'), 'o'),
                        new ChannelEntity(ChannelEntity::WHATSHOT, $this->l10n->t('What\'s Hot'), $this->l10n->t('Posts with a lot of interactions'), 'h'),
                        new ChannelEntity(ChannelEntity::LANGUAGE, $native, $this->l10n->t('Posts in %s', $native), 'g'),
                        new ChannelEntity(ChannelEntity::FOLLOWERS, $this->l10n->t('Followers'), $this->l10n->t('Posts from your followers that you don\'t follow'), 'f'),
@@ -54,6 +55,6 @@ final class Channel extends Timeline
 
        public function isTimeline(string $selectedTab): bool
        {
-               return in_array($selectedTab, [ChannelEntity::WHATSHOT, ChannelEntity::FORYOU, ChannelEntity::FOLLOWERS, ChannelEntity::SHARERSOFSHARERS, ChannelEntity::IMAGE, ChannelEntity::VIDEO, ChannelEntity::AUDIO, ChannelEntity::LANGUAGE]);
+               return in_array($selectedTab, [ChannelEntity::WHATSHOT, ChannelEntity::FORYOU, ChannelEntity::DISCOVER, ChannelEntity::FOLLOWERS, ChannelEntity::SHARERSOFSHARERS, ChannelEntity::IMAGE, ChannelEntity::VIDEO, ChannelEntity::AUDIO, ChannelEntity::LANGUAGE]);
        }
 }
index 0baa40f7f1cfc2403e3e14218efe83cc703dd819..5a117998907ff89c2af7457705547aabbfdaad00 100644 (file)
@@ -115,7 +115,7 @@ class Channel extends Timeline
 
                        $this->page['aside'] .= Widget::accountTypes('channel/' . $this->selectedTab, $this->accountTypeString);
 
-                       if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU])) {
+                       if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU, ChannelEntity::DISCOVER])) {
                                $this->page['aside'] .= $this->getNoSharerWidget('channel');
                        }
 
index db801d707b67f0e0b2fd345d6a1a6fca1988eb84..1b375d099dbd9cb2255c24774ef7f780470ed862 100644 (file)
@@ -291,6 +291,20 @@ class Timeline extends BaseModule
                                $cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid,
                                $uid, Contact\User::FREQUENCY_ALWAYS
                        ];
+               } elseif ($this->selectedTab == ChannelEntity::DISCOVER) {
+                       $cid = Contact::getPublicIdByUserId($uid);
+
+                       $condition = [
+                               "`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND NOT `follows`) AND
+                               (`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND NOT `follows` AND `relation-thread-score` > ?) OR
+                               `owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `cid` = ? AND `relation-thread-score` > ?) OR
+                               ((`comments` >= ? OR `activities` >= ?) AND 
+                               (`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `cid` = ? AND `relation-thread-score` > ?)) OR 
+                               (`owner-id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `relation-thread-score` > ?))))",
+                               $cid, $cid, $this->getMedianRelationThreadScore($cid, 4), $cid, $this->getMedianRelationThreadScore($cid, 4),
+                               $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid, 0, $cid, 0 
+                       ];
+
                } elseif ($this->selectedTab == ChannelEntity::FOLLOWERS) {
                        $condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER];
                } elseif ($this->selectedTab == ChannelEntity::SHARERSOFSHARERS) {
index fbe1d1b617bb74e3ed566a19911f0eb3b74e92cf..ddad6d4c428b353bd51555f24fe4eb5931ea6b11 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2024.03-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-01-23 22:10+0000\n"
+"POT-Creation-Date: 2024-01-25 10:48+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -791,7 +791,7 @@ msgstr ""
 msgid "All contacts"
 msgstr ""
 
-#: src/BaseModule.php:439 src/Content/Conversation/Factory/Channel.php:45
+#: src/BaseModule.php:439 src/Content/Conversation/Factory/Channel.php:46
 #: src/Content/Widget.php:239 src/Core/ACL.php:195 src/Module/Contact.php:414
 #: src/Module/PermissionTooltip.php:141 src/Module/PermissionTooltip.php:163
 #: src/Module/Settings/Channels.php:147
@@ -1526,54 +1526,62 @@ msgid "Posts from contacts you interact with and who interact with you"
 msgstr ""
 
 #: src/Content/Conversation/Factory/Channel.php:43
-msgid "What's Hot"
+msgid "Discover"
 msgstr ""
 
 #: src/Content/Conversation/Factory/Channel.php:43
-msgid "Posts with a lot of interactions"
+msgid "Posts from accounts that you don't follow, but that you might like."
 msgstr ""
 
 #: src/Content/Conversation/Factory/Channel.php:44
+msgid "What's Hot"
+msgstr ""
+
+#: src/Content/Conversation/Factory/Channel.php:44
+msgid "Posts with a lot of interactions"
+msgstr ""
+
+#: src/Content/Conversation/Factory/Channel.php:45
 #, php-format
 msgid "Posts in %s"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:45
+#: src/Content/Conversation/Factory/Channel.php:46
 msgid "Posts from your followers that you don't follow"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:46
+#: src/Content/Conversation/Factory/Channel.php:47
 msgid "Sharers of sharers"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:46
+#: src/Content/Conversation/Factory/Channel.php:47
 msgid "Posts from accounts that are followed by accounts that you follow"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:47
+#: src/Content/Conversation/Factory/Channel.php:48
 #: src/Module/Settings/Channels.php:184 src/Module/Settings/Channels.php:203
 msgid "Images"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:47
+#: src/Content/Conversation/Factory/Channel.php:48
 msgid "Posts with images"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:48
+#: src/Content/Conversation/Factory/Channel.php:49
 #: src/Module/Settings/Channels.php:186 src/Module/Settings/Channels.php:205
 msgid "Audio"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:48
+#: src/Content/Conversation/Factory/Channel.php:49
 msgid "Posts with audio"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:49
+#: src/Content/Conversation/Factory/Channel.php:50
 #: src/Module/Settings/Channels.php:185 src/Module/Settings/Channels.php:204
 msgid "Videos"
 msgstr ""
 
-#: src/Content/Conversation/Factory/Channel.php:49
+#: src/Content/Conversation/Factory/Channel.php:50
 msgid "Posts with videos"
 msgstr ""