mirror of
https://github.com/friendica/friendica
synced 2025-04-27 19:50:12 +00:00
The transmitted language is now stored
This commit is contained in:
parent
2f1ec8e144
commit
dbda317c6d
3 changed files with 21 additions and 8 deletions
|
@ -2002,13 +2002,23 @@ class Item
|
|||
return $item['language'];
|
||||
}
|
||||
|
||||
$transmitted = [];
|
||||
foreach ($item['transmitted-languages'] ?? [] as $language) {
|
||||
$transmitted[$language] = 0;
|
||||
}
|
||||
|
||||
if (!in_array($item['gravity'], [self::GRAVITY_PARENT, self::GRAVITY_COMMENT]) || empty($item['body'])) {
|
||||
return '';
|
||||
return empty($transmitted) ? '' : json_encode($transmitted);
|
||||
}
|
||||
|
||||
$languages = self::getLanguageArray($item['title'] . ' ' . ($item['content-warning'] ?? '') . ' ' . $item['body'], 3, $item['uri-id'], $item['author-id']);
|
||||
if (empty($languages)) {
|
||||
return '';
|
||||
return empty($transmitted) ? '' : json_encode($transmitted);
|
||||
}
|
||||
|
||||
if (!empty($transmitted)) {
|
||||
$languages = array_merge($transmitted, $languages);
|
||||
arsort($languages);
|
||||
}
|
||||
|
||||
return json_encode($languages);
|
||||
|
@ -2209,7 +2219,7 @@ class Item
|
|||
|
||||
// Glue it together to be able to make a hash from it
|
||||
if (!empty($parsed)) {
|
||||
$host_id = implode('/', $parsed);
|
||||
$host_id = implode('/', (array)$parsed);
|
||||
} else {
|
||||
$host_id = $uri;
|
||||
}
|
||||
|
@ -3435,7 +3445,7 @@ class Item
|
|||
unset($urlparts['fragment']);
|
||||
|
||||
try {
|
||||
$url = (string)Uri::fromParts($urlparts);
|
||||
$url = (string)Uri::fromParts((array)$urlparts);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
DI::logger()->notice('Invalid URL', ['$url' => $url, '$urlparts' => $urlparts]);
|
||||
/* See https://github.com/friendica/friendica/issues/12113
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue