[ENTITY][Language] Properly handle context actor language

This commit is contained in:
Hugo Sales 2021-11-26 12:29:27 +00:00
parent d7a71ebe33
commit 04e6b2fb53
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 3 additions and 3 deletions

View File

@ -378,7 +378,7 @@ class Actor extends Entity
public function getPreferredLanguageChoices(?self $context = null): array public function getPreferredLanguageChoices(?self $context = null): array
{ {
$id = $context?->getId() ?? $this->getId(); $id = $context?->getId() ?? $this->getId();
$key = ActorLanguage::collectionCacheKey($this); // TODO handle language context $key = ActorLanguage::collectionCacheKey($this, $context);
$langs = Cache::getHashMap( $langs = Cache::getHashMap(
$key, $key,
fn () => F\reindex( fn () => F\reindex(

View File

@ -79,9 +79,9 @@ class ActorLanguage extends Entity
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
// }}} Autocode // }}} Autocode
public static function collectionCacheKey(LocalUser|Actor $actor) public static function collectionCacheKey(LocalUser|Actor $actor, ?Actor $content = null)
{ {
return 'actor-' . $actor->getId() . '-langs'; return 'actor-' . $actor->getId() . '-langs' . (!\is_null($content) ? '-cxt-' . $content->getId() : '');
} }
public static function normalizeOrdering(LocalUser|Actor $actor) public static function normalizeOrdering(LocalUser|Actor $actor)