[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
{
$id = $context?->getId() ?? $this->getId();
$key = ActorLanguage::collectionCacheKey($this); // TODO handle language context
$key = ActorLanguage::collectionCacheKey($this, $context);
$langs = Cache::getHashMap(
$key,
fn () => F\reindex(

View File

@ -79,9 +79,9 @@ class ActorLanguage extends Entity
// @codeCoverageIgnoreEnd
// }}} 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)