-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Bug]: Editing depicts clears every other structured data associated with the image #5728
Comments
How long has this problem been here? Can I get any class reference to the related code? |
This might be a good place to start: https://github.com/commons-app/apps-android-commons/blob/main/app/src/main/java/fr/free/nrw/commons/wikidata/WikidataEditService.java#L108 |
The clear=1 in the linked line looks suspicious. It's worth exploring if toggling that helps. |
Ah. That's an interesting observation.
Got it. So, it seems like the |
Yes, the other data information is retained. One more thing I noticed in the docs, i.e., the clear flag should be set like |
I don't think we have to worry about that discrepancy since the clearing was happening without any doubt. The examples in |
We have to pass the whole structured data so that the entity gets updated with previous data as well as edited data. Currently, we are passing only depicted item's IDs, that's why only that gets updated and other data is cleared out due to a clear flag. |
@sivaraam |
Look at here: updating categories This updation doesn't delete the old structured data and the reason is, the previous data is appended rather than clearing old data and adding just the modified one. Here, this function is responsible for updating categories and there is a parameter "wikiText" that is being passed and manipulated with the updated categories. Afterward, this function is responsible for replacing the old wikiText(The text that contains the file's data) with the new updated one. However, this is the wikiText that was first fetched from the server and there is nothing like depictions, why? What are your thoughts about this? |
Yeah. Those are friendly bots that run in Commons just doing their job. No issues about that :-) |
You are confusing category edit and depictions edit. Both are different and even use different APIs. Categories exist in commons. Depictions has to do with structured data. You could check this article for reference on Structured data on Commons. Hope that clears your confusion. |
Hey @sivaraam, I solved the issue but, the whole task is being done on two phases:-
See history Although, after so much research and debugging the second way I can see is, set clear flag, it'll delete the whole entity and then send updated depictions along with other related data that was deleted. I hope I was helpful :) |
Summary
Our editing of depicts seems to cause a bit more harm than good now. When trying to edit the depictions, the depictions are changed but all other structured data associated with the image such as the "caption", "creator" etc. are totally removed. We should make sure such a thing doesn't happen.
Sample edits that demonstrate this issue: [edit 1] [edit 2]
This one feels a bit serious and it is not even easy to revert such edits due to some abuse filter blocking such reverts [ref]. Can we just disable editing of depictions as a temporary measure until this one's fixed? If trivial, it would be great to just fix the core issue, of course 🙂
Steps to reproduce
Expected behaviour
Only the list of depictions of the structured data get modified as a consequence of the edit.
Actual behaviour
The edit results in all other structured data associated with the image being removed and only the new set of depicts being retained.
Device name
OnePlus Nord
Android version
12
Commons app version
5.0.1
Device logs
No response
Screen-shots
No response
Would you like to work on the issue?
None
The text was updated successfully, but these errors were encountered: