Skip to content

Commit d6e1601

Browse files
dbrantcooltey
andauthored
Image recs: insert into infobox only for English. (#4679)
Co-authored-by: Cooltey Feng <cfeng@wikimedia.org>
1 parent 7faaa1e commit d6e1601

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/src/main/java/org/wikipedia/edit/insertmedia/InsertMediaViewModel.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ class InsertMediaViewModel(bundle: Bundle) : ViewModel() {
220220
}
221221
}
222222

223-
if (autoInsert && attemptInfobox && infoboxMatch != null) {
223+
// Verify a few conditions before attempting to insert into an infobox, including
224+
// whether the infobox actually exists, and whether the current language wiki is
225+
// supported by our hardcoded infoboxVars.
226+
if (autoInsert && attemptInfobox && infoboxMatch != null && infoboxVarsByLang.containsKey(langCode)) {
224227
val infoboxStartIndex = infoboxMatch.range.first
225228
val infoboxEndIndex = infoboxMatch.range.last
226229

0 commit comments

Comments
 (0)