Skip image upload to Wikidata if item already has image

This commit is contained in:
sonalyadav 2025-06-20 21:30:12 +05:30
parent 9eff9e8e82
commit c1aead8b24
2 changed files with 6 additions and 10 deletions

View file

@ -473,6 +473,8 @@ class UploadWorker(
if (!contribution.hasInvalidLocation()) { if (!contribution.hasInvalidLocation()) {
var revisionID: Long? = null var revisionID: Long? = null
try { try {
// Only set P18 if the place does not already have a picture
if (wikiDataPlace.imageValue.isNullOrBlank()) {
revisionID = revisionID =
wikidataEditService.createClaim( wikidataEditService.createClaim(
wikiDataPlace, wikiDataPlace,
@ -489,7 +491,11 @@ class UploadWorker(
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.blockingAwait() .blockingAwait()
Timber.d("Updated WikiItem place ${place.name} with image ${place.pic}") Timber.d("Updated WikiItem place ${place.name} with image ${place.pic}")
}
showSuccessNotification(contribution)
} }
} else {
// Place already has a picture, so skip setting P18 but still show success notification
showSuccessNotification(contribution) showSuccessNotification(contribution)
} }
} catch (exception: Exception) { } catch (exception: Exception) {

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Vlad5250
-->
<resources>
<string name="crash_dialog_title">کامَنٕز گوو رُکِتھ</string>
<string name="crash_dialog_text">Oops. کیہہ تام گوو غلط!</string>
<string name="crash_dialog_comment_prompt">ؤنِیوٚ اَسہِ توٚہہِ کیاہ ٲسِیوٚ کران، تہٕ کٕریٚو تہِ اَسہِ سٕتی شیر بذریعہِ برقی خط. یُس مَدَتھ کَرِ اَسہِ اَتھ شہَرنَس منٛز!</string>
<string name="crash_dialog_ok_toast">شُکریہ!</string>
</resources>