-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support undoing archived batches #54
Comments
This is indeed not supported yet: it would first require unarchiving it. This means re-fetching all the edits in the batch, for instance by fetching user contributions. Then, the batch could be undone again. |
I would like to help getting this done. Can someone point me in the right direction? |
Of course! When archiving batches, we remove in our database all of their edits but the last 10 ones. It's a measure to prevent EditGroup's own database from growing too much as time goes by. The archiving of batches is done periodically with this method: Lines 267 to 277 in b674c84
So, if we want to undo a batch that has been archived, we need to re-fetch the edits that are deleted by this method. Then, for the unarchiving itself, as mentioned above we could look into querying the MediaWiki API to fetch the contributions of the user. In our batch metadata, we know when the batch started and ended, so we just need to fetch the contributions between those times. The tasks that come to mind here would be:
This is the core backend work for this issue and it'd be worth writing test cases for it (this code base is pretty extensively tested so it should not be too hard to imitate what is already there). Finally, we'd need to expose the unarchiving feature in the frontend. This means adding a route to let the user trigger the unarchiving, and expose the corresponding button in the frontend, by modifying the template that displays batches: I hope this description is not too daunting and I'd be happy to give more details where needed! |
I just thought of another approach: instead of adding support for un-archiving batches, one could also consider a less demanding approach: "simply" fetch the edits from the MediaWiki API when undoing them, in a streaming fashion. This means that we don't even need to save them back to the database. It probably also gives a better UX: the undo button would remain available on all batches, whether they are archived or not, and users would not need to first unarchive the batch before undoing it. With this approach, the core of the work would be to write a Python generator which would iterate through the edits of a particular user between two timestamps, filtering out the edits which do not belong to a particular batch. This would then be used in the undoing task in place of the iteration on the edits ingested in the database. We'd need to make some small tweaks to update the number of undone edits in the Batch metadata (since currently, this is updated by the general edit ingestion logic, not the undoing code) but that does not seem to difficult. |
https://editgroups.toolforge.org/b/CB/8f5438bc04fc/
I would like to undo that one. How do I do that?
The text was updated successfully, but these errors were encountered: