This commit is contained in:
Sujal-Gupta-SG 2025-02-01 18:01:07 +05:30
parent bb14edfe70
commit 9a66a74a49
3 changed files with 3 additions and 10 deletions

View file

@ -269,11 +269,8 @@ class UploadClient
uniqueFileName!!,
fileKey!!,
).map { uploadResponse: JsonObject? ->
Timber.d(uploadResponse.toString())
val uploadResult = gson.fromJson(uploadResponse, UploadResponse::class.java)
if (uploadResult.upload == null) {
// Parse the error to MwException
val exception = gson.fromJson(uploadResponse, MwException::class.java)
Timber.e(exception, "Error in uploading file from stash")

View file

@ -469,21 +469,18 @@ class UploadWorker(
contribution: Contribution,
) {
val wikiDataPlace = contribution.wikidataPlace
if (wikiDataPlace != null) {
if (!contribution.hasInvalidLocation()) {
var revisionID: Long? = null
try {
// Always attempt to update the image claim with the latest photo
revisionID = wikidataEditService.createClaim(
revisionID =
wikidataEditService.createClaim(
wikiDataPlace,
uploadResult.filename,
contribution.media.captions,
)
if (null != revisionID) {
withContext(Dispatchers.IO) {
// Fetch and update place details
val place = placesRepository.fetchPlace(wikiDataPlace.id)
place.name = wikiDataPlace.name
place.pic = HOME_URL + uploadResult.createCanonicalFileName()
@ -514,7 +511,6 @@ class UploadWorker(
}
}
}
saveCompletedContribution(contribution, uploadResult)
}

View file

@ -38,7 +38,7 @@ class WikiBaseClient
* @param filename name of the file
* @param data data of the depicts to be uploaded
* @return Observable<Boolean>
</Boolean> */
</Boolean> */
fun postEditEntityByFilename(
filename: String?,
data: String?,