Don't log 'ninja' edits (within 5 minutes) → What if another user does the edit?
Closed this issue · 8 comments
As far as I could see, you are not checking against another userid.
Scenario: User 1 does an edit, user 2 does an edit 3 min later. Now, in v0.9, edit version of user 1 gets overwritten.
This should be saved actually.
We need to compare the editor (userid) as well.
I am still searching for a way to tell other editors that a question is edited right now. This would solve this issue here. Maybe the question could be blocked for edit if in edit mode? mhhh... as part of this plugin?
Posts in q2a forum:
• How to prevent simultaneous edits to not lose content? http://www.question2answer.org/qa/17540/
• your old post: http://question2answer.org/qa/2469/ but this is not the exact answer, I guess.
That old post of mine is a completely different issue. That was about checking what page the user is on, to display some content.
I will have a think about the simultaneous editing issue, there is probably a way to work round that.
that would be great!
if I can help you, let me know.
"there is probably a way to work round that."
- Maybe we can just tell the other editor/user that an edit is not possible at the moment (message)?
- Or we just hide the edit button if the last edit is <10 min ago (maybe more elegant).
But I don't know how to intercept the core action, when user clicks on "edit" button, resp. when user loads site, checking the database for the post's last edit and hiding the edit button (could be done by css)...
Just an inspiration maybe you find a better way handling this.
Kai
Maybe this will help: "create an event plugin [event module] and in the process_event function I did a if ($event == 'q_edit') { } - and in that if clause I added my code to update the database with my custom data." from http://www.question2answer.org/qa/12595/
Dear Scott,
I think another plugin is needed for this purpose, which creates another db-table.
I tried to start development, but do not know how to continue from event module... I opened a request on that, see also the "scenario": http://www.question2answer.org/qa/19289/how-to-output-html-from-event-module-plugin
Thank you!
Kai
Besides the new plugin that hopefully helps prevent overwrites. I think we should just add another boolean to:
if ( abs($now-$lastupdate) < 300 ) return;
e.g. (pseudo code)
if ( abs($now-$lastupdate) < 300 & $olduser == $recentuser ) return;
Could you add this to qa-edit-history.php?
Hi @echteinfachtv, this has been fixed in the most recent version of the plugin. If the edit is made within the 'ninja edit time' it's registered as a separate revision.