Merge pull request #13857 from annando/discover
New channel option "discover"
This commit is contained in:
commit
142a563a80
|
@ -25,6 +25,10 @@ Predefined Channels
|
||||||
* Posts from people you interact with on a more than average level.
|
* 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 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.
|
* 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.
|
* What's Hot: Posts with a more than average number of interactions.
|
||||||
* Language: Posts in your language.
|
* Language: Posts in your language.
|
||||||
* Followers: Posts from your followers that you don't follow.
|
* Followers: Posts from your followers that you don't follow.
|
||||||
|
|
|
@ -25,6 +25,7 @@ class Channel extends Timeline
|
||||||
{
|
{
|
||||||
const WHATSHOT = 'whatshot';
|
const WHATSHOT = 'whatshot';
|
||||||
const FORYOU = 'foryou';
|
const FORYOU = 'foryou';
|
||||||
|
const DISCOVER = 'discover';
|
||||||
const FOLLOWERS = 'followers';
|
const FOLLOWERS = 'followers';
|
||||||
const SHARERSOFSHARERS = 'sharersofsharers';
|
const SHARERSOFSHARERS = 'sharersofsharers';
|
||||||
const IMAGE = 'image';
|
const IMAGE = 'image';
|
||||||
|
|
|
@ -40,6 +40,7 @@ final class Channel extends Timeline
|
||||||
|
|
||||||
$tabs = [
|
$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::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::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::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'),
|
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
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ class Channel extends Timeline
|
||||||
|
|
||||||
$this->page['aside'] .= Widget::accountTypes('channel/' . $this->selectedTab, $this->accountTypeString);
|
$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');
|
$this->page['aside'] .= $this->getNoSharerWidget('channel');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
||||||
use Friendica\App\Mode;
|
use Friendica\App\Mode;
|
||||||
use Friendica\Content\BoundariesPager;
|
use Friendica\Content\BoundariesPager;
|
||||||
use Friendica\Content\Conversation;
|
use Friendica\Content\Conversation;
|
||||||
|
use Friendica\Content\Conversation\Entity\Channel;
|
||||||
use Friendica\Content\Conversation\Entity\Network as NetworkEntity;
|
use Friendica\Content\Conversation\Entity\Network as NetworkEntity;
|
||||||
use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
|
use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
|
||||||
use Friendica\Content\Conversation\Repository\UserDefinedChannel;
|
use Friendica\Content\Conversation\Repository\UserDefinedChannel;
|
||||||
|
@ -142,6 +143,11 @@ class Network extends Timeline
|
||||||
$this->page['aside'] .= Widget\SavedSearches::getHTML($this->args->getQueryString());
|
$this->page['aside'] .= Widget\SavedSearches::getHTML($this->args->getQueryString());
|
||||||
$this->page['aside'] .= Widget::fileAs('filed', '');
|
$this->page['aside'] .= Widget::fileAs('filed', '');
|
||||||
|
|
||||||
|
if (($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) &&
|
||||||
|
!in_array($this->selectedTab, [Channel::FOLLOWERS, Channel::FORYOU, Channel::DISCOVER])) {
|
||||||
|
$this->page['aside'] .= $this->getNoSharerWidget('network');
|
||||||
|
}
|
||||||
|
|
||||||
if (Feature::isEnabled($this->session->getLocalUserId(), 'trending_tags')) {
|
if (Feature::isEnabled($this->session->getLocalUserId(), 'trending_tags')) {
|
||||||
$this->page['aside'] .= TrendingTags::getHTML($this->selectedTab);
|
$this->page['aside'] .= TrendingTags::getHTML($this->selectedTab);
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,20 @@ class Timeline extends BaseModule
|
||||||
$cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid,
|
$cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid,
|
||||||
$uid, Contact\User::FREQUENCY_ALWAYS
|
$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) {
|
} elseif ($this->selectedTab == ChannelEntity::FOLLOWERS) {
|
||||||
$condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER];
|
$condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER];
|
||||||
} elseif ($this->selectedTab == ChannelEntity::SHARERSOFSHARERS) {
|
} elseif ($this->selectedTab == ChannelEntity::SHARERSOFSHARERS) {
|
||||||
|
|
|
@ -791,7 +791,7 @@ msgstr ""
|
||||||
msgid "All contacts"
|
msgid "All contacts"
|
||||||
msgstr ""
|
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/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/PermissionTooltip.php:141 src/Module/PermissionTooltip.php:163
|
||||||
#: src/Module/Settings/Channels.php:147
|
#: src/Module/Settings/Channels.php:147
|
||||||
|
@ -1526,54 +1526,62 @@ msgid "Posts from contacts you interact with and who interact with you"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:43
|
#: src/Content/Conversation/Factory/Channel.php:43
|
||||||
msgid "What's Hot"
|
msgid "Discover"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:43
|
#: 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 ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:44
|
#: 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
|
#, php-format
|
||||||
msgid "Posts in %s"
|
msgid "Posts in %s"
|
||||||
msgstr ""
|
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"
|
msgid "Posts from your followers that you don't follow"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:46
|
#: src/Content/Conversation/Factory/Channel.php:47
|
||||||
msgid "Sharers of sharers"
|
msgid "Sharers of sharers"
|
||||||
msgstr ""
|
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"
|
msgid "Posts from accounts that are followed by accounts that you follow"
|
||||||
msgstr ""
|
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
|
#: src/Module/Settings/Channels.php:184 src/Module/Settings/Channels.php:203
|
||||||
msgid "Images"
|
msgid "Images"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:47
|
#: src/Content/Conversation/Factory/Channel.php:48
|
||||||
msgid "Posts with images"
|
msgid "Posts with images"
|
||||||
msgstr ""
|
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
|
#: src/Module/Settings/Channels.php:186 src/Module/Settings/Channels.php:205
|
||||||
msgid "Audio"
|
msgid "Audio"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:48
|
#: src/Content/Conversation/Factory/Channel.php:49
|
||||||
msgid "Posts with audio"
|
msgid "Posts with audio"
|
||||||
msgstr ""
|
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
|
#: src/Module/Settings/Channels.php:185 src/Module/Settings/Channels.php:204
|
||||||
msgid "Videos"
|
msgid "Videos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Conversation/Factory/Channel.php:49
|
#: src/Content/Conversation/Factory/Channel.php:50
|
||||||
msgid "Posts with videos"
|
msgid "Posts with videos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user