'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'post-type', 'post-reason',
'private', 'pubmail', 'visible', 'starred',
'unseen', 'deleted', 'origin', 'mention', 'global', 'network',
- 'title', 'content-warning', 'body', 'location', 'coord', 'app',
+ 'title', 'content-warning', 'body', 'language', 'location', 'coord', 'app',
'rendered-hash', 'rendered-html', 'object-type', 'object', 'target-type', 'target',
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network',
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'causer-id'
return;
}
+ $languages = $item['language'] ? array_keys(json_decode($item['language'], true)) : [];
+
foreach (Tag::getUIDListByURIId($item['uri-id']) as $uid => $tags) {
+ if (!empty($languages)) {
+ $keep = false;
+ $user_languages = User::getWantedLanguages($uid);
+ foreach ($user_languages as $language) {
+ if (in_array($language, $languages)) {
+ $keep = true;
+ }
+ }
+ if ($keep) {
+ Logger::debug('Wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
+ } else {
+ Logger::debug('No wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
+ continue;
+ }
+ }
+
$stored = self::storeForUserByUriId($item['uri-id'], $uid, ['post-reason' => self::PR_TAG]);
Logger::info('Stored item for users', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
foreach ($tags as $tag) {
private function addLanguageCondition(int $uid, array $condition): array
{
$conditions = [];
- $languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid)]);
+ $languages = User::getWantedLanguages($uid);
foreach ($languages as $language) {
$conditions[] = "JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?";
$condition[] = $language;
private function getMedianComments(int $uid, int $divider): int
{
- $languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid)]);
+ $languages = User::getWantedLanguages($uid);
$cache_key = 'Channel:getMedianComments:' . $divider . ':' . implode(':', $languages);
$comments = $this->cache->get($cache_key);
if (!empty($comments)) {
private function getMedianActivities(int $uid, int $divider): int
{
- $languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid)]);
+ $languages = User::getWantedLanguages($uid);
$cache_key = 'Channel:getMedianActivities:' . $divider . ':' . implode(':', $languages);
$activities = $this->cache->get($cache_key);
if (!empty($activities)) {
$bookmarked_timelines = $this->pConfig->get($uid, 'system', 'network_timelines', $this->getAvailableTimelines($uid, true)->column('code'));
$enabled_timelines = $this->pConfig->get($uid, 'system', 'enabled_timelines', $this->getAvailableTimelines($uid, false)->column('code'));
- $channel_languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid)]);
+ $channel_languages = User::getWantedLanguages($uid);
$languages = $this->l10n->getLanguageCodes(true);
$timelines = [];