use Friendica\Network\HTTPException;
use Friendica\Core\Session\Model\UserSession;
use Friendica\Database\Database;
+use Friendica\Model\Item;
use Friendica\Module\Response;
use Friendica\Navigation\SystemMessages;
use Friendica\Util\Profiler;
const VIDEO = 'video';
const AUDIO = 'audio';
const LANGUAGE = 'language';
- const HOTLANG = 'hotlang';
protected static $content;
protected static $accountTypeString;
$language = User::getLanguageCode($this->session->getLocalUserId(), false);
$languages = $this->l10n->getAvailableLanguages();
+
$tabs[] = [
'label' => $languages[$language],
'url' => 'channel/' . self::LANGUAGE,
'accesskey' => 'g'
];
- $tabs[] = [
- 'label' => $this->l10n->t('What`s Hot (%s)', $languages[$language]),
- 'url' => 'channel/' . self::HOTLANG,
- 'sel' => self::$content == self::HOTLANG ? 'active' : '',
- 'title' => $this->l10n->t('Posts in %s with a lot of interactions', $languages[$language]),
- 'id' => 'channel-hotlang-tab',
- 'accesskey' => 'o'
- ];
-
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
self::$content = self::FORYOU;
}
- if (!in_array(self::$content, [self::WHATSHOT, self::FORYOU, self::FOLLOWERS, self::IMAGE, self::VIDEO, self::AUDIO, self::LANGUAGE, self::HOTLANG])) {
+ if (!in_array(self::$content, [self::WHATSHOT, self::FORYOU, self::FOLLOWERS, self::IMAGE, self::VIDEO, self::AUDIO, self::LANGUAGE])) {
throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
}
} else {
$condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ?", $this->getMedianComments(4), $this->getMedianActivities(4), Contact::TYPE_COMMUNITY];
}
+
+ $condition = $this->addLanguageCondition($condition);
} elseif (self::$content == self::FORYOU) {
$cid = Contact::getPublicIdByUserId($this->session->getLocalUserId());
$condition = ["`media-type` & ?", 4];
} elseif (self::$content == self::LANGUAGE) {
$condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", User::getLanguageCode($this->session->getLocalUserId(), true)];
- } elseif (self::$content == self::HOTLANG) {
- if (!is_null(self::$accountType)) {
- $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` = ? AND JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?",
- $this->getMedianComments(4), $this->getMedianActivities(4), self::$accountType, User::getLanguageCode($this->session->getLocalUserId(), true)];
- } else {
- $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ? AND JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?",
- $this->getMedianComments(4), $this->getMedianActivities(4), Contact::TYPE_COMMUNITY, User::getLanguageCode($this->session->getLocalUserId(), true)];
- }
}
$condition[0] .= " AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed`))";
}
$items = $this->database->selectToArray('post-engagement', ['uri-id', 'created'], $condition, $params);
-
if (empty($items)) {
return [];
}
$items = array_reverse($items);
}
+ Item::update(['unseen' => false], ['unseen' => true, 'uid' => $this->session->getLocalUserId(), 'uri-id' => array_column($items, 'uri-id')]);
+
return $items;
}
+ private function addLanguageCondition(array $condition): array
+ {
+ $conditions = [];
+ $languages = $this->pConfig->get($this->session->getLocalUserId(), 'channel', 'languages', [User::getLanguageCode($this->session->getLocalUserId(), false)]);
+ foreach ($languages as $language) {
+ $conditions[] = "JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?";
+ $condition[] = substr($language, 0, 2);
+ }
+ if (!empty($conditions)) {
+ $condition[0] .= " AND (`language` IS NULL OR " . implode(' OR ', $conditions) . ")";
+ }
+ return $condition;
+ }
+
private function getMedianComments(int $divider): int
{
$cache_key = 'Channel:getMedianComments:' . $divider;
$theme = !empty($request['theme']) ? trim($request['theme']) : $user['theme'];
$mobile_theme = !empty($request['mobile_theme']) ? trim($request['mobile_theme']) : '';
$enable_smile = !empty($request['enable_smile']) ? intval($request['enable_smile']) : 0;
+ $channel_languages = !empty($request['channel_languages']) ? $request['channel_languages'] : [];
$first_day_of_week = !empty($request['first_day_of_week']) ? intval($request['first_day_of_week']) : 0;
$calendar_default_view = !empty($request['calendar_default_view']) ? trim($request['calendar_default_view']) : 'month';
$infinite_scroll = !empty($request['infinite_scroll']) ? intval($request['infinite_scroll']) : 0;
$this->pConfig->set($uid, 'system', 'stay_local' , $stay_local);
$this->pConfig->set($uid, 'system', 'preview_mode' , $preview_mode);
+ $this->pConfig->set($uid, 'channel', 'languages' , $channel_languages);
+
$this->pConfig->set($uid, 'calendar', 'first_day_of_week' , $first_day_of_week);
- $this->pConfig->set($uid, 'calendar', 'default_view' , $calendar_default_view);
+ $this->pConfig->set($uid, 'calendar', 'default_view' , $calendar_default_view);
if (in_array($theme, Theme::getAllowedList())) {
if ($theme == $user['theme']) {
BBCode::PREVIEW_LARGE => $this->t('Large Image'),
];
+ $channel_languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid, false)]);
+ $languages = $this->l10n->getAvailableLanguages();
$first_day_of_week = $this->pConfig->get($uid, 'calendar', 'first_day_of_week', 0);
$weekdays = [
'$d_ctset' => $this->t('Custom Theme Settings'),
'$d_cset' => $this->t('Content Settings'),
'$stitle' => $this->t('Theme settings'),
+ '$channel_title' => $this->t('Channels'),
'$calendar_title' => $this->t('Calendar'),
'$form_security_token' => self::getFormSecurityToken('settings_display'),
'$stay_local' => ['stay_local' , $this->t('Stay local'), $stay_local, $this->t("Don't go to a remote system when following a contact link.")],
'$preview_mode' => ['preview_mode' , $this->t('Link preview mode'), $preview_mode, $this->t('Appearance of the link preview that is added to each post with a link.'), $preview_modes, false],
+ '$channel_languages' => ['channel_languages[]', $this->t('Channel languages:'), $channel_languages, $this->t('Select all languages that you want to see in your channels.'), $languages, 'multiple'],
+
'$first_day_of_week' => ['first_day_of_week' , $this->t('Beginning of week:') , $first_day_of_week , '', $weekdays , false],
'$calendar_default_view' => ['calendar_default_view', $this->t('Default calendar view:'), $calendar_default_view, '', $calendarViews, false],
]);
msgstr ""
"Project-Id-Version: 2023.09-dev\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-09-03 08:52+0000\n"
+"POT-Creation-Date: 2023-09-03 12: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"
#: src/Module/Register.php:245 src/Module/Search/Directory.php:37
#: src/Module/Settings/Account.php:50 src/Module/Settings/Account.php:408
#: src/Module/Settings/Delegation.php:41 src/Module/Settings/Delegation.php:71
-#: src/Module/Settings/Display.php:69 src/Module/Settings/Display.php:151
+#: src/Module/Settings/Display.php:69 src/Module/Settings/Display.php:154
#: src/Module/Settings/Profile/Photo/Crop.php:165
#: src/Module/Settings/Profile/Photo/Index.php:111
#: src/Module/Settings/RemoveMe.php:117 src/Module/Settings/UserExport.php:80
#: src/Content/Nav.php:233 src/Content/Nav.php:295
#: src/Module/BaseProfile.php:85 src/Module/BaseProfile.php:88
#: src/Module/BaseProfile.php:96 src/Module/BaseProfile.php:99
-#: src/Module/Settings/Display.php:252 view/theme/frio/theme.php:236
+#: src/Module/Settings/Display.php:258 view/theme/frio/theme.php:236
#: view/theme/frio/theme.php:240
msgid "Calendar"
msgstr ""
msgid "Conversations on this and other servers"
msgstr ""
-#: src/Content/Nav.php:292
-msgid "Channel"
+#: src/Content/Nav.php:292 src/Module/Settings/Display.php:257
+msgid "Channels"
msgstr ""
#: src/Content/Nav.php:292
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:430
-#: src/Module/Settings/Display.php:222
+#: src/Module/Settings/Display.php:227
msgid "Monday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:431
-#: src/Module/Settings/Display.php:223
+#: src/Module/Settings/Display.php:228
msgid "Tuesday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:432
-#: src/Module/Settings/Display.php:224
+#: src/Module/Settings/Display.php:229
msgid "Wednesday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:433
-#: src/Module/Settings/Display.php:225
+#: src/Module/Settings/Display.php:230
msgid "Thursday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:434
-#: src/Module/Settings/Display.php:226
+#: src/Module/Settings/Display.php:231
msgid "Friday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:435
-#: src/Module/Settings/Display.php:227
+#: src/Module/Settings/Display.php:232
msgid "Saturday"
msgstr ""
#: src/Core/L10n.php:408 src/Model/Event.php:429
-#: src/Module/Settings/Display.php:221
+#: src/Module/Settings/Display.php:226
msgid "Sunday"
msgstr ""
msgstr ""
#: src/Model/Event.php:463 src/Module/Calendar/Show.php:129
-#: src/Module/Settings/Display.php:232 src/Util/Temporal.php:353
+#: src/Module/Settings/Display.php:237 src/Util/Temporal.php:353
msgid "month"
msgstr ""
#: src/Model/Event.php:464 src/Module/Calendar/Show.php:130
-#: src/Module/Settings/Display.php:233 src/Util/Temporal.php:354
+#: src/Module/Settings/Display.php:238 src/Util/Temporal.php:354
msgid "week"
msgstr ""
#: src/Model/Event.php:465 src/Module/Calendar/Show.php:131
-#: src/Module/Settings/Display.php:234 src/Util/Temporal.php:355
+#: src/Module/Settings/Display.php:239 src/Util/Temporal.php:355
msgid "day"
msgstr ""
#: src/Module/Settings/Account.php:561 src/Module/Settings/Addons.php:78
#: src/Module/Settings/Connectors.php:160
#: src/Module/Settings/Connectors.php:246
-#: src/Module/Settings/Delegation.php:171 src/Module/Settings/Display.php:247
+#: src/Module/Settings/Delegation.php:171 src/Module/Settings/Display.php:252
#: src/Module/Settings/Features.php:76
msgid "Save Settings"
msgstr ""
msgid "%s is no valid input for maximum image size"
msgstr ""
-#: src/Module/Admin/Site.php:313 src/Module/Settings/Display.php:169
+#: src/Module/Admin/Site.php:313 src/Module/Settings/Display.php:172
msgid "No special theme for mobile devices"
msgstr ""
-#: src/Module/Admin/Site.php:330 src/Module/Settings/Display.php:179
+#: src/Module/Admin/Site.php:330 src/Module/Settings/Display.php:182
#, php-format
msgid "%s - (Experimental)"
msgstr ""
msgid "Create New Event"
msgstr ""
-#: src/Module/Calendar/Show.php:132 src/Module/Settings/Display.php:235
+#: src/Module/Calendar/Show.php:132 src/Module/Settings/Display.php:240
msgid "list"
msgstr ""
msgid "Posts with audio"
msgstr ""
-#: src/Module/Conversation/Channel.php:189
+#: src/Module/Conversation/Channel.php:190
#, php-format
msgid "Posts in %s"
msgstr ""
-#: src/Module/Conversation/Channel.php:195
-#, php-format
-msgid "What`s Hot (%s)"
-msgstr ""
-
-#: src/Module/Conversation/Channel.php:198
-#, php-format
-msgid "Posts in %s with a lot of interactions"
-msgstr ""
-
-#: src/Module/Conversation/Channel.php:230
+#: src/Module/Conversation/Channel.php:222
#: src/Module/Conversation/Community.php:134
msgid "Own Contacts"
msgstr ""
-#: src/Module/Conversation/Channel.php:234
+#: src/Module/Conversation/Channel.php:226
#: src/Module/Conversation/Community.php:138
msgid "Include"
msgstr ""
-#: src/Module/Conversation/Channel.php:235
+#: src/Module/Conversation/Channel.php:227
#: src/Module/Conversation/Community.php:139
msgid "Hide"
msgstr ""
-#: src/Module/Conversation/Channel.php:251
+#: src/Module/Conversation/Channel.php:243
#: src/Module/Conversation/Community.php:157 src/Module/Search/Index.php:152
#: src/Module/Search/Index.php:194
msgid "No results."
msgstr ""
-#: src/Module/Conversation/Channel.php:291
+#: src/Module/Conversation/Channel.php:283
msgid "Channel not available."
msgstr ""
msgid "No entries."
msgstr ""
-#: src/Module/Settings/Display.php:137
+#: src/Module/Settings/Display.php:140
msgid "The theme you chose isn't available."
msgstr ""
-#: src/Module/Settings/Display.php:177
+#: src/Module/Settings/Display.php:180
#, php-format
msgid "%s - (Unsupported)"
msgstr ""
-#: src/Module/Settings/Display.php:212
+#: src/Module/Settings/Display.php:215
msgid "No preview"
msgstr ""
-#: src/Module/Settings/Display.php:213
+#: src/Module/Settings/Display.php:216
msgid "No image"
msgstr ""
-#: src/Module/Settings/Display.php:214
+#: src/Module/Settings/Display.php:217
msgid "Small Image"
msgstr ""
-#: src/Module/Settings/Display.php:215
+#: src/Module/Settings/Display.php:218
msgid "Large Image"
msgstr ""
-#: src/Module/Settings/Display.php:246
+#: src/Module/Settings/Display.php:251
msgid "Display Settings"
msgstr ""
-#: src/Module/Settings/Display.php:248
+#: src/Module/Settings/Display.php:253
msgid "General Theme Settings"
msgstr ""
-#: src/Module/Settings/Display.php:249
+#: src/Module/Settings/Display.php:254
msgid "Custom Theme Settings"
msgstr ""
-#: src/Module/Settings/Display.php:250
+#: src/Module/Settings/Display.php:255
msgid "Content Settings"
msgstr ""
-#: src/Module/Settings/Display.php:251 view/theme/duepuntozero/config.php:86
+#: src/Module/Settings/Display.php:256 view/theme/duepuntozero/config.php:86
#: view/theme/frio/config.php:172 view/theme/quattro/config.php:88
#: view/theme/vier/config.php:136
msgid "Theme settings"
msgstr ""
-#: src/Module/Settings/Display.php:257
+#: src/Module/Settings/Display.php:263
msgid "Display Theme:"
msgstr ""
-#: src/Module/Settings/Display.php:258
+#: src/Module/Settings/Display.php:264
msgid "Mobile Theme:"
msgstr ""
-#: src/Module/Settings/Display.php:261
+#: src/Module/Settings/Display.php:267
msgid "Number of items to display per page:"
msgstr ""
-#: src/Module/Settings/Display.php:261 src/Module/Settings/Display.php:262
+#: src/Module/Settings/Display.php:267 src/Module/Settings/Display.php:268
msgid "Maximum of 100 items"
msgstr ""
-#: src/Module/Settings/Display.php:262
+#: src/Module/Settings/Display.php:268
msgid "Number of items to display per page when viewed from mobile device:"
msgstr ""
-#: src/Module/Settings/Display.php:263
+#: src/Module/Settings/Display.php:269
msgid "Update browser every xx seconds"
msgstr ""
-#: src/Module/Settings/Display.php:263
+#: src/Module/Settings/Display.php:269
msgid "Minimum of 10 seconds. Enter -1 to disable it."
msgstr ""
-#: src/Module/Settings/Display.php:264
+#: src/Module/Settings/Display.php:270
msgid "Display emoticons"
msgstr ""
-#: src/Module/Settings/Display.php:264
+#: src/Module/Settings/Display.php:270
msgid "When enabled, emoticons are replaced with matching symbols."
msgstr ""
-#: src/Module/Settings/Display.php:265
+#: src/Module/Settings/Display.php:271
msgid "Infinite scroll"
msgstr ""
-#: src/Module/Settings/Display.php:265
+#: src/Module/Settings/Display.php:271
msgid "Automatic fetch new items when reaching the page end."
msgstr ""
-#: src/Module/Settings/Display.php:266
+#: src/Module/Settings/Display.php:272
msgid "Enable Smart Threading"
msgstr ""
-#: src/Module/Settings/Display.php:266
+#: src/Module/Settings/Display.php:272
msgid "Enable the automatic suppression of extraneous thread indentation."
msgstr ""
-#: src/Module/Settings/Display.php:267
+#: src/Module/Settings/Display.php:273
msgid "Display the Dislike feature"
msgstr ""
-#: src/Module/Settings/Display.php:267
+#: src/Module/Settings/Display.php:273
msgid "Display the Dislike button and dislike reactions on posts and comments."
msgstr ""
-#: src/Module/Settings/Display.php:268
+#: src/Module/Settings/Display.php:274
msgid "Display the resharer"
msgstr ""
-#: src/Module/Settings/Display.php:268
+#: src/Module/Settings/Display.php:274
msgid "Display the first resharer as icon and text on a reshared item."
msgstr ""
-#: src/Module/Settings/Display.php:269
+#: src/Module/Settings/Display.php:275
msgid "Stay local"
msgstr ""
-#: src/Module/Settings/Display.php:269
+#: src/Module/Settings/Display.php:275
msgid "Don't go to a remote system when following a contact link."
msgstr ""
-#: src/Module/Settings/Display.php:270
+#: src/Module/Settings/Display.php:276
msgid "Link preview mode"
msgstr ""
-#: src/Module/Settings/Display.php:270
+#: src/Module/Settings/Display.php:276
msgid "Appearance of the link preview that is added to each post with a link."
msgstr ""
-#: src/Module/Settings/Display.php:272
+#: src/Module/Settings/Display.php:278
+msgid "Channel languages:"
+msgstr ""
+
+#: src/Module/Settings/Display.php:278
+msgid "Select all languages that you want to see in your channels."
+msgstr ""
+
+#: src/Module/Settings/Display.php:280
msgid "Beginning of week:"
msgstr ""
-#: src/Module/Settings/Display.php:273
+#: src/Module/Settings/Display.php:281
msgid "Default calendar view:"
msgstr ""