Skip to content

Commit

Permalink
Enforce null.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrant committed Aug 29, 2024
1 parent 1337fd0 commit 55e649a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ object EditingSuggestionsProvider {
}
} else {
// If the wiki uses Wikidata descriptions, check protection status of the Wikidata items.
val qNums = resultsWithNoDescription.mapNotNull { it.pageProps?.wikiBaseItem }
val qNums = resultsWithNoDescription.mapNotNull { it.pageProps?.wikiBaseItem.orEmpty().ifEmpty { null } }
val wdResponse = ServiceFactory.get(Constants.wikidataWikiSite).getProtection(qNums.joinToString("|"))
val unprotectedQNums = wdResponse.query?.pages?.filter { it.protection.isEmpty() }?.map { it.title }

Expand Down Expand Up @@ -128,7 +128,7 @@ object EditingSuggestionsProvider {
articlesWithTranslatableDescriptionCacheToLang = targetLang

// Get the Wikidata entities for the articles, to see if they have descriptions in the source language.
val qNums = resultsWithNoDescription.mapNotNull { it.pageProps?.wikiBaseItem }
val qNums = resultsWithNoDescription.mapNotNull { it.pageProps?.wikiBaseItem.orEmpty().ifEmpty { null } }
val wdResponse = ServiceFactory.get(Constants.wikidataWikiSite).getWikidataLabelsAndDescriptions(
qNums.joinToString("|"),
WikiSite.normalizeLanguageCode(sourceWiki.languageCode) + "|" + WikiSite.normalizeLanguageCode(targetLang),
Expand Down

0 comments on commit 55e649a

Please sign in to comment.