summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-09-28 14:49:13 +0200
committerYorhel <git@yorhel.nl>2022-09-28 14:49:15 +0200
commitfab2e0bd5e61099e379a04da6e5214c4514e0957 (patch)
treeb08e8aba24ce40fddb0eceac3310074fa236716d
parentc492db0e7c6a81bb0aa4a7de46d8138d4641cc45 (diff)
LangPref: Always fall back to original title
Even if the user doesn't have that configured for some reason. I have no clue how someone managed to do that, though.
-rw-r--r--lib/VNWeb/LangPref.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VNWeb/LangPref.pm b/lib/VNWeb/LangPref.pm
index 8f82546f..38e9475f 100644
--- a/lib/VNWeb/LangPref.pm
+++ b/lib/VNWeb/LangPref.pm
@@ -78,6 +78,8 @@ my $CURRENT_SESSION = $DEFAULT_SESSION;
sub pref {
my $titles = langpref_parse(auth->pref('title_langs')) // $DEFAULT_TITLE_LANGS;
my $alttitles = langpref_parse(auth->pref('alttitle_langs')) // $DEFAULT_ALTTITLE_LANGS;
+ # Make sure that we always have a fallback to the original title.
+ push @$titles, @$DEFAULT_TITLE_LANGS if !@$titles || defined $titles->[$#$titles]{lang};
tuwf->req->{langpref} //= [ $titles, $alttitles, langpref_fmt($titles).langpref_fmt($alttitles) ];
}