mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Skip image upload to Wikidata (nearby -> green pins) (#6349)
Some checks failed
Android CI / Run tests and generate APK (push) Has been cancelled
Some checks failed
Android CI / Run tests and generate APK (push) Has been cancelled
* Skip image upload to Wikidata if item already has image * Re-run CI * no more Failed to update Wikidata for green pins
This commit is contained in:
parent
ca5c7ec966
commit
09da7b8d68
3 changed files with 12 additions and 13 deletions
|
|
@ -472,7 +472,10 @@ class UploadWorker(
|
|||
if (wikiDataPlace != null) {
|
||||
if (!contribution.hasInvalidLocation()) {
|
||||
var revisionID: Long? = null
|
||||
val p18WasSkipped = !wikiDataPlace.imageValue.isNullOrBlank()
|
||||
try {
|
||||
if (!p18WasSkipped) {
|
||||
// Only set P18 if the place does not already have a picture
|
||||
revisionID =
|
||||
wikidataEditService.createClaim(
|
||||
wikiDataPlace,
|
||||
|
|
@ -489,9 +492,11 @@ class UploadWorker(
|
|||
.subscribeOn(Schedulers.io())
|
||||
.blockingAwait()
|
||||
Timber.d("Updated WikiItem place ${place.name} with image ${place.pic}")
|
||||
}
|
||||
}
|
||||
showSuccessNotification(contribution)
|
||||
}
|
||||
// Always show success notification, whether P18 was set or skipped
|
||||
showSuccessNotification(contribution)
|
||||
} catch (exception: Exception) {
|
||||
Timber.e(exception)
|
||||
}
|
||||
|
|
@ -500,6 +505,7 @@ class UploadWorker(
|
|||
wikidataEditService.handleImageClaimResult(
|
||||
contribution.wikidataPlace!!,
|
||||
revisionID,
|
||||
p18WasSkipped = p18WasSkipped
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -196,13 +196,16 @@ class WikidataEditService @Inject constructor(
|
|||
return wikidataClient.setClaim(claim, COMMONS_APP_TAG).blockingSingle()
|
||||
}
|
||||
|
||||
fun handleImageClaimResult(wikidataItem: WikidataItem, revisionId: Long?) {
|
||||
fun handleImageClaimResult(wikidataItem: WikidataItem, revisionId: Long?, p18WasSkipped: Boolean = false) {
|
||||
if (revisionId != null) {
|
||||
wikidataEditListener?.onSuccessfulWikidataEdit()
|
||||
showSuccessToast(wikidataItem.name)
|
||||
} else {
|
||||
} else if (!p18WasSkipped) {
|
||||
Timber.d("Unable to make wiki data edit for entity %s", wikidataItem)
|
||||
showLongToast(context, context.getString(R.string.wikidata_edit_failure))
|
||||
} else {
|
||||
Timber.d("Wikidata edit skipped for entity %s because P18 already exists", wikidataItem)
|
||||
// No error shown to user, as this is not a failure
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue