ryanthompson - 2 months ago
I have need to push one more feature into 3.5 and want to get some feedback.
The idea is to prevent 2 users from editing a record at the same time through the control panel. So if I am editing a page and someone else on my team logs in and goes to edit the same page they will get a notice that I am editing it and saving will be prohibited until I leave / release.
My thoughts are a JS script attached to the forms UI polls a lock table every (for example) 10 seconds. If no lock exists is creates one and touches the timestamp subsequently. The lock will use.. I guess the URL or maybe stream ID/entry ID as well as the logged in user ID.
As user B my poll would NOT create cause a lock file for the record exists and I don't own it - so I am disabled from saving / UI tells me so. I text user A and tell em to get lost and they leave the page in which case my next poll sees that the lock hasn't been updated in say.. 15 seconds and replaces the lock owner with my user ID instead. We can later build in a release link or something as well.