-
Notifications
You must be signed in to change notification settings - Fork 24
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
[WJ-1032] Add file_rollback #2133
Conversation
#[sea_orm(string_value = "undelete")] | ||
Undelete, | ||
#[sea_orm(string_value = "undo")] | ||
Undo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does PageRevisionType::Undo
mean? Is it like the opposite of a rollback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undos are a planned operation. I am avoiding the term "revert" because it means two different things in git vs wikidot, and instead have two unambiguous terms:
- Rollback (what wikidot calls "revert", what git calls "reset") is where you set the current state of a page or file to some revision in the past.
- Undo (what git calls "revert") is where it applies the opposite of the given revision. Since this involves applying a diff, it can fail.
An example of the difference between the two. Imagine we have a page with this history:
Revision 10
**Item #:** SCP-XX
**Object Class:** Euclid
**Special Containment Procedures:** SCP-XX is to be kept in a cardboard box.
Revision 11
**Item #:** SCP-XX
**Object Class:** HAHA EPIC TROLL
**Special Containment Procedures:** SCP-XX is to be kept in a cardboard box.
Revision 12
**Item #:** SCP-XX
**Object Class:** HAHA EPIC TROLL
**Special Containment Procedures:** SCP-XX is to be kept in a cardboard or paper box.
So here, revision 11 is vandalism and we'd like to remove it. But the page has been edited since, so that means we'd lose any subsequent (legitimate) changes with a simple rollback. But using undo, similar to git revert
, we can remove just the specific change from 10 -> 11 and leave the 12 revision in-place.
So basically it would produce the 11..10 diff (not that this is the inverse of the 10..11 diff that was applied in revision 11):
3c3
< **Object Class:** HAHA EPIC TROLL
---
> **Object Class:** Euclid
And then we could attempt to apply it.
(If there are conflicts, then like git revert
, we should error out rather than attempting to ram our way through. Also, we should have some way of allowing a user to verify that the undo change is what they want before doing it.)
thanks @Zokhoi |
This adds rollback capability to files, which like for page rollbacks, changes a file to have the same state it had earlier. (This cannot be used to move a file to a different page). While working on this, I discovered a bug in file moves where it wasn't properly updating the name.
Example output after local tests: