Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#24829 closed defect (bug) (fixed)

Don't allow users to restore a revision if the post is locked

Reported by: aaroncampbell's profile aaroncampbell Owned by: aaroncampbell's profile aaroncampbell
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.6
Component: General Keywords: needs-patch
Focuses: Cc:

Description

Currently a user that's locked out of a post by our AMAZING new post locking, can still restore a revision of that post. It would be nice to let them browser revisions, but we should prevent them from restoring one while someone else has the post locked.

Attachments (3)

24829.diff (1.1 KB) - added by adamsilverstein 11 years ago.
disable restore button when post locked, disallow restore if locked (while on revisions screen)
24829.2.diff (701 bytes) - added by aaroncampbell 11 years ago.
24829.3.diff (1.0 KB) - added by markjaquith 11 years ago.

Download all attachments as: .zip

Change History (14)

#1 follow-up: @adamsilverstein
11 years ago

interesting - nice catch! seems like users should be kicked out the revisions screen if another user takes over the post lock.

#2 in reply to: ↑ 1 @aaroncampbell
11 years ago

Replying to adamsilverstein:

seems like users should be kicked out the revisions screen if another user takes over the post lock.

Honestly, I'd rather that they be allowed into the revisions screen and even be able to browse revisions, but not be allowed to restore (remove the UI for it, or replace it with a short "post is locked" message).

Also, when a lock is taken from someone and they are kicked out, the last thing that happens is an autosave that we do for them before we kick them. I'm wondering if it might be a good idea to have a button on the lock taken dialog that offers to send them to their latest autosave in revisions? Thoughts? Here's the dialog:

http://f.cl.ly/items/0A1r1A0g2P3j2R042V3y/wp-lock-taken.png

@adamsilverstein
11 years ago

disable restore button when post locked, disallow restore if locked (while on revisions screen)

#3 follow-up: @aaroncampbell
11 years ago

24829.2.diff disables the existing button instead of using a different one with a new string.

#4 in reply to: ↑ 3 @adamsilverstein
11 years ago

Replying to aaroncampbell:

24829.2.diff disables the existing button instead of using a different one with a new string.

ah simplicity! I forgot - no new strings! We can add better/live post-locking info on the revisions screen in the future.

@markjaquith
11 years ago

#5 follow-up: @markjaquith
11 years ago

24829.diff just puts the Backbone disabled rendering in a PHP else so that we don't get double disabled=disabled happening in the case of a current revision of a post that is also being edited by someone else.

#6 in reply to: ↑ 5 ; follow-up: @adamsilverstein
11 years ago

Replying to markjaquith:

24829.diff just puts the Backbone disabled rendering in a PHP else so that we don't get double disabled=disabled happening in the case of a current revision of a post that is also being edited by someone else.

tested & works as expected.

#7 in reply to: ↑ 6 @AaronCAmpbell
11 years ago

Replying to adamsilverstein:

Replying to markjaquith:

24829.diff just puts the Backbone disabled rendering in a PHP else so that we don't get double disabled=disabled happening in the case of a current revision of a post that is also being edited by someone else.

tested & works as expected.

Assuming you tested .3.diff not just .diff?

#8 @nacin
11 years ago

What if the current user has the lock? As in, they opened "Browse" in a new window? What happens if they try to restore something with the editor open? (Just curious.)

#9 @aaroncampbell
11 years ago

  • Owner set to aaroncampbell
  • Resolution set to fixed
  • Status changed from new to closed

In 24827:

Disable ability to restore a revision if another user has the post lock

props adamsilverstein. Fixes #24829 for trunk.

#10 @aaroncampbell
11 years ago

In 24828:

Disable ability to restore a revision if another user has the post lock

props adamsilverstein. Fixes #24829 for 3.6.

#11 @aaroncampbell
11 years ago

In 24874:

Fixes JavaScript error caused by [24828] which was an improper port of [24827]

See #24829

Note: See TracTickets for help on using tickets.