Update function / rearrange tab order
This commit is contained in:
parent
5144654067
commit
e186395198
|
@ -31,9 +31,9 @@ General
|
||||||
|
|
||||||
../channel
|
../channel
|
||||||
--------
|
--------
|
||||||
* h - what's hot
|
|
||||||
* y - for you
|
* y - for you
|
||||||
* f - followers
|
* f - followers
|
||||||
|
* h - what's hot
|
||||||
|
|
||||||
../profile
|
../profile
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -87,6 +87,10 @@ class Engagement
|
||||||
Verb::getID(Activity::FOLLOW), Verb::getID(Activity::VIEW), Verb::getID(Activity::READ)
|
Verb::getID(Activity::FOLLOW), Verb::getID(Activity::VIEW), Verb::getID(Activity::READ)
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
if (($engagement['comments'] == 0) && ($engagement['activities'] == 0)) {
|
||||||
|
Logger::debug('No comments nor activities. Engagement not stored', ['fields' => $engagement]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
$ret = DBA::insert('post-engagement', $engagement, Database::INSERT_UPDATE);
|
$ret = DBA::insert('post-engagement', $engagement, Database::INSERT_UPDATE);
|
||||||
Logger::debug('Engagement stored', ['fields' => $engagement, 'ret' => $ret]);
|
Logger::debug('Engagement stored', ['fields' => $engagement, 'ret' => $ret]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,15 +78,6 @@ class Channel extends BaseModule
|
||||||
if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
|
if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
|
|
||||||
$tabs[] = [
|
|
||||||
'label' => DI::l10n()->t('Whats Hot'),
|
|
||||||
'url' => 'channel/' . self::WHATSHOT,
|
|
||||||
'sel' => self::$content == self::WHATSHOT ? 'active' : '',
|
|
||||||
'title' => DI::l10n()->t('Posts with a lot of interactions'),
|
|
||||||
'id' => 'channel-whatshot-tab',
|
|
||||||
'accesskey' => 'h'
|
|
||||||
];
|
|
||||||
|
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
'label' => DI::l10n()->t('For you'),
|
'label' => DI::l10n()->t('For you'),
|
||||||
'url' => 'channel/' . self::FORYOU,
|
'url' => 'channel/' . self::FORYOU,
|
||||||
|
@ -104,6 +95,15 @@ class Channel extends BaseModule
|
||||||
'id' => 'channel-followers-tab',
|
'id' => 'channel-followers-tab',
|
||||||
'accesskey' => 'f'
|
'accesskey' => 'f'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$tabs[] = [
|
||||||
|
'label' => DI::l10n()->t('Whats Hot'),
|
||||||
|
'url' => 'channel/' . self::WHATSHOT,
|
||||||
|
'sel' => self::$content == self::WHATSHOT ? 'active' : '',
|
||||||
|
'title' => DI::l10n()->t('Posts with a lot of interactions'),
|
||||||
|
'id' => 'channel-whatshot-tab',
|
||||||
|
'accesskey' => 'h'
|
||||||
|
];
|
||||||
|
|
||||||
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||||
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
||||||
|
@ -189,7 +189,7 @@ class Channel extends BaseModule
|
||||||
|
|
||||||
self::$content = $this->parameters['content'] ?? '';
|
self::$content = $this->parameters['content'] ?? '';
|
||||||
if (!self::$content) {
|
if (!self::$content) {
|
||||||
self::$content = self::WHATSHOT;
|
self::$content = self::FORYOU;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array(self::$content, [self::WHATSHOT, self::FORYOU, self::FOLLOWERS])) {
|
if (!in_array(self::$content, [self::WHATSHOT, self::FORYOU, self::FOLLOWERS])) {
|
||||||
|
|
13
update.php
13
update.php
|
@ -62,6 +62,7 @@ use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Protocol\Delivery;
|
use Friendica\Protocol\Delivery;
|
||||||
use Friendica\Security\PermissionSet\Repository\PermissionSet;
|
use Friendica\Security\PermissionSet\Repository\PermissionSet;
|
||||||
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
// Post-update script of PR 5751
|
// Post-update script of PR 5751
|
||||||
function update_1298()
|
function update_1298()
|
||||||
|
@ -1377,3 +1378,15 @@ function update_1525(): int
|
||||||
|
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1531()
|
||||||
|
{
|
||||||
|
$threads = Post::selectThread(Item::DELIVER_FIELDLIST, ["`uid` = ? AND `created` > ?", 0, DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' hour')]);
|
||||||
|
while ($post = Post::fetch($threads)) {
|
||||||
|
$post['gravity'] = Item::GRAVITY_COMMENT;
|
||||||
|
Post\Engagement::storeFromItem($post);
|
||||||
|
}
|
||||||
|
DBA::close($threads);
|
||||||
|
|
||||||
|
return Update::SUCCESS;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user