There are two possibilities to implement the rollback functionality.
Do an additional edit
This is how it is done in Wikipedia.
When a user adds "blabla" to a text, the rollback is the same as an edit where the text "blabla" would be deleted.
Translated to OmegaWiki:
- for data that has been added, rollback means deleting the data by changing the remove_transaction_id from NULL to something.
- for data that has been removed, rollback means adding back the data, e.g. adding a new syntrans corresponding to the one that was deleted.
- Since the syntrans_id is changed, any annotation that was dependent on that syntrans should be changed, either by adding new annotations, or by amending the old annotation and change the syntrans_id on which they depend.
Problem is: if a word "dictionary" added by "user" is deleted by "spammer" and then rollbacked by "sysop", the word will then be identified as having been added by "sysop" (in the history). It would be nice to keep "user" as the one who added the word.
To keep the attribution of an added word to the user, after spammer and rollback, we can do the following:
- for data that has been added (by "spammer"), same as above, delete the data by changing the remove_transaction_id from NULL to "something". "something" will correspond to a removal of the data by "sysop".
- for data that has been removed, rollback by changing the remove_transaction_id from "something" to NULL
- in that case, add_transaction_id still identifies the user who added the word
- the annotation will reappear automatically without the need to change anything
However, what was rollback will not be visible. The traces of "spammer" will be completely lost.
A solution could be to add a table "uw_rollback_log" where the operations performed by a specific rollback are stored. It would look like this:
|1||123456||uw_syntrans||111 (syntrans_id)||XXX <- this identifies "spammer"|