WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 6 months ago

#44900 new enhancement

add post lock display to Media Library

Reported by: pbiron Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-screenshots needs-design
Focuses: ui, administration Cc:
PR Number:

Description

WP_Posts_List_Table shows which posts are currently being edited by other users (screenshot coming).

WP_Media_List_Table should do so as well (screenshot coming).

Much of the support for post locks on media already exists in core:

  1. when media is edited (in list mode, see below for discussion on grid mode), core already correctly updates the _edit_lock and _edit_last postmetas for the attachment
  2. both ends of the "Take Over" modal dialog already function as expected when editing media (screenshots coming)

To support post locks for media several other things need to happen:

  1. add the appropriate markup to the output of WP_Media_List_Table (in list mode, see below for discussion on grid mode)
  2. /wp-admin/upload.php needs to enqueue:
    1. the Heartbeat API
    2. JS that uses the Heartbeat API to update the post lock display

A patch that does the above is coming shortly.

As hinted at above, handling post locks in grid mode will require more work:

  1. design work will be needed for how to display the fact that there is a post lock in grid mode (screenshot coming)
    1. once that design work is done then code (probably JS) will need to be written to implement the design
  2. several changes will be needed to the "Attachment Details" screen that comes up when an attachment is clicked on from grid mode:
    1. the _edit_lock and _edit_last postmetas will need to be updated when the user enters this screen
    2. some JS based on the Heartbeat API will need to check for newly acquired post locks and fire the "Take Over" modal dialog
    3. I think the previous item will take care of things when the user clicks on the "Edit Image" button from the "Attachment Details" screen, but that remains to be seen
    4. Note: when a user clicks on the "Edit more details" link the existing core functionality and the changes to list mode above take over and no more changes are needed to handle that

I'm unfamiliar with the JS-side of grid mode so at this point can't provide a patch for those changes, but would gladly help someone else work on that (if only so I can learn that JS piece).

Attachments (7)

post_lock.png (8.7 KB) - added by pbiron 16 months ago.
this is how WP_Posts_List_Table displays post locks
media_post_lock.png (11.4 KB) - added by pbiron 16 months ago.
this is how WP_Media_List_Table should display post locks
taken-over.png (34.5 KB) - added by pbiron 16 months ago.
this show one end of the "Take Over" modal dialog for media
taken-over.2.png (34.5 KB) - added by pbiron 16 months ago.
this show the other end of the "Take Over" modal dialog for media
44900-list-mode.diff (5.6 KB) - added by pbiron 16 months ago.
patch the covers the needed changes to list mode
take-over.png (25.8 KB) - added by pbiron 16 months ago.
this show the other end of the "Take Over" modal dialog for media
grid-mode-design-work-needed.png (15.6 KB) - added by pbiron 16 months ago.
need design work for how to display that media has a post lock when in grid mode

Download all attachments as: .zip

Change History (20)

@pbiron
16 months ago

this is how WP_Posts_List_Table displays post locks

@pbiron
16 months ago

this is how WP_Media_List_Table should display post locks

@pbiron
16 months ago

this show one end of the "Take Over" modal dialog for media

@pbiron
16 months ago

this show the other end of the "Take Over" modal dialog for media

@pbiron
16 months ago

patch the covers the needed changes to list mode

#1 follow-up: @pbiron
16 months ago

44900-list-mode.diff covers the needed changes for list mode.

Of note is that the new /wp-admin/js/post-lock.js file (heartbeat API code to update the display when post locks change) is extracted from /wp-admin/js/inline-edit-post.js. If this ticket is accepted I would suggest removing that code from inline-edit-post.js (so that it only truly handles the inline editing stuff) and having /wp-admin/edit.php enqueue the new post-lock.js file in addition to inline-edit-post.js.

@pbiron
16 months ago

this show the other end of the "Take Over" modal dialog for media

#2 @pbiron
16 months ago

disregard taken-over.2.png. I accidentally uploaded the same image twice. take-over.png is what I had meant to upload for "this show the other end of the "Take Over" modal dialog for media".

#3 in reply to: ↑ 1 @pbiron
16 months ago

Replying to pbiron:

44900-list-mode.diff covers the needed changes for list mode.

Also note that in order to test this, after applying the patch you'll need to run grunt to move the new post-lock.js file into the correct location.

@pbiron
16 months ago

need design work for how to display that media has a post lock when in grid mode

#4 follow-up: @joemcgill
8 months ago

  • Milestone changed from Awaiting Review to Future Release

Hi @pbiron,

I think this would be a really nice enhancement. I'm going to mark it for a future release for now, but let's consider it for 5.3 if you're up for seeing it through.

#5 in reply to: ↑ 4 @pbiron
8 months ago

Replying to joemcgill:

I think this would be a really nice enhancement. I'm going to mark it for a future release for now, but let's consider it for 5.3 if you're up for seeing it through.

I'm definitely up for it...although I'm pretty swamped for the next month or so, thus it depends on when 5.3-beta1 will be.

As mentioned, I'll need help with the grid mode JS. It would also be helpful if you could wrangle some design input ASAP.

This ticket was mentioned in Slack in #core-media by pbiron. View the logs.


8 months ago

This ticket was mentioned in Slack in #design by pbiron. View the logs.


7 months ago

This ticket was mentioned in Slack in #core-media by pbiron. View the logs.


7 months ago

#9 @desrosj
7 months ago

  • Keywords needs-design-feedback added; needs-design removed

#10 @desrosj
7 months ago

When someone is editing a post and they are managing an image, I believe that any changes made there (to the title, alt text, etc.) are currently saved to the attachment and are not specific to the current post.

If post locking were to be implemented for attachments, the images should probably also be locked in the post edit context as well. This would need to be explored in both the block editor and Classic Editor contexts (for backwards compatibility).

#11 @pbiron
7 months ago

thanx for the comment @desrosj. I thought that's what you were referring to in slack.

I think that the changes required for grid mode, covered in this ticket's description

  1. several changes will be needed to the "Attachment Details" screen that comes up when an attachment is clicked on from grid mode:
    • the _edit_lock and _edit_last postmetas will need to be updated when the user enters this screen

will cover the case of an image edited from the within the post edit context, since it uses the same JS as the grid mode does.

But once the design work for grid mode is done and I dig in to implement the changes to the media JS I'll be sure to verify that the above supposition is actually true.

This ticket was mentioned in Slack in #design by pbiron. View the logs.


6 months ago

#13 @boemedia
6 months ago

  • Keywords needs-design added; needs-design-feedback removed

Changing the keyword back from needs design feedback to needs design.

As this ticket is in need for a design for the media grid mode when locked. Would also be good to get some design eyes on the list mode, as this is a little different from post lists mode, since it has a thumbnail.

Great project for a starting design contributor to make some suggestions in mockups.

Note: See TracTickets for help on using tickets.