Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent deletion of other structured data when editing depicts #5741

Merged
merged 13 commits into from
Aug 26, 2024

Conversation

rohit9625
Copy link
Contributor

Description (required)

Before: Previously, the API was deleting whole entity data and updating with new depictions.
Now: Two APIs are used to delete older depictions only and update with the new ones.

Note:- Please provide your valuable insights about the changes as I am not familiar with using Multi-threading in Java but familiar with Coroutines in Kotlin :)

Fixes #5728

What changes did you make and why?
Major Changes
WikiBaseInterface.kt: Added new methods to use two new APIs to get the work done.
WikidataEditService: Updated method to update depictions that performs deletion and creation of depiction. Although, added some utility functions for convenience.

Some Additional Changes
File DepictsDao.kt, was using runBlocking to perform database operations, resulting in the blocking of the current Thread in which the runBlocking was used. So, I replaced them with the Coroutines.

Some minor changes to related files for better readability

Tests performed (required)

Tested ProdDebug on Samsung A14 with API level 34.

Screenshots (for UI changes only)
None

@sivaraam
Copy link
Member

sivaraam commented Jun 2, 2024

Thank you for these changes! It's great that you were able to identify a workaround for the whole structured data being removed by only removing and adding the depictions. While this is an improvement from the status quo, it would be great if we could use more optimal route of just achieving this in a single edit rather than two (if possible).

Could you possibly check the feasibility of the same by writing to the wikitech-l / Commons-l mailing list ?

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works great.
Atomicity and kdoc would be great, but fixing the data loss is more urgent.

@nicolas-raoul nicolas-raoul merged commit 46df64d into commons-app:main Aug 26, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Editing depicts clears every other structured data associated with the image
3 participants