Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#43820 closed enhancement (fixed)

Add "Mine" filter for attachments similarly to posts and comments

Reported by: azaozz's profile azaozz Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9.6 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch dev-feedback commit fixed-major
Focuses: ui Cc:

Description

This will be quite useful for users that want to see, edit or export their data.

The functionality already exists. Attachments can be filtered by user name when clicking on the "Author" in the Media Library (in list-table view). To make it more accessible we would need to add a little bit of UI, perhaps another <option> under the "Media items" drop-down.

Attachments (3)

43820.diff (1.1 KB) - added by audrasjb 7 years ago.
Adds Mine filter in list-table media view
grid-view.gif (949.4 KB) - added by audrasjb 7 years ago.
Demo
43820.2.diff (8.9 KB) - added by audrasjb 7 years ago.
Add "Mine" filter to both media library table view & grid view

Download all attachments as: .zip

Change History (17)

@audrasjb
7 years ago

Adds Mine filter in list-table media view

#1 @audrasjb
7 years ago

  • Keywords has-patch added

Hello,

43820.diff adds "Mine" filter to list-table view.

Not sure we can add this filtering option to the grid view without creating a new js file…

Cheers,
Jb

#2 follow-up: @desrosj
7 years ago

43820.diff looks good, but if we add it to the "All media items" dropdown, I would like to also see this on the grid view. The top bar UI is exactly the same, so I think it should match.

#3 in reply to: ↑ 2 @audrasjb
7 years ago

Replying to desrosj:

I would like to also see this on the grid view. The top bar UI is exactly the same, so I think it should match.

Sure, but grid view is not generated the same way: it's full JS UI, and I'm wondering if we need a new file in /wp-includes/js/media/views/attachment-filters
I will look closely to this today.

@audrasjb
7 years ago

Demo

#4 @audrasjb
7 years ago

  • Keywords dev-feedback added

Hi,

43820.2.diff handles both table/list and grid view, but since this is a pretty complex patch (for me), I'd like to get a review on the JS/grid-view part.
cc @azaozz @desrosj

Cheers,
Jb

@audrasjb
7 years ago

Add "Mine" filter to both media library table view & grid view

#5 @audrasjb
7 years ago

Just updated 43820.2.diff to remove an unnecessary comma.
I checked my code again today, and I think it looks good.

#6 @azaozz
7 years ago

In 43056:

Privacy: add "Mine" filter for media similarly to posts and comments.

Props audrasjb.
See #43820.

#7 follow-up: @azaozz
7 years ago

  • Keywords commit fixed-major added

Looks good. media-models.js and media-views.js are auto-generated files, the actual changes should go in wp-includes/js/media/views/... dir.

#8 in reply to: ↑ 7 ; follow-up: @audrasjb
7 years ago

Replying to azaozz:

Looks good. media-models.js and media-views.js are auto-generated files, the actual changes should go in wp-includes/js/media/views/... dir.

Thanks for the review @azaozz
Do you mean the final file is auto-generated or do I need to update my patch?
Sorry for this stupid question but I can't find any /wp-includes/js/media/views/… dir on my local dev installation…

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

#10 in reply to: ↑ 8 ; follow-up: @azaozz
7 years ago

Replying to audrasjb:

Do you mean the final file is auto-generated or do I need to update my patch?

Nah, I fixed it and committed it. Just next time when making a patch for the media library (js), it's better if you patch the appropriate file in /wp-includes/js/media/*, not one of the auto-generated files. Then when you run grunt precommit, media-models.js and media-views.js will be updated.

#11 in reply to: ↑ 10 @audrasjb
7 years ago

Ok, got it.
I reproduced the patch on my side to learn how to do it the good way next time.
Thank you

#12 @SergeyBiryukov
7 years ago

In 43062:

I18N: Add context for "Mine" string added in [43056].

See #43820.

#13 @SergeyBiryukov
7 years ago

In 43063:

Privacy: Move "Mine" filter for media items above "Trash".

See #43820.

#14 @SergeyBiryukov
7 years ago

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

In 43064:

Privacy: add "Mine" filter for media similarly to posts and comments.

Props audrasjb.
Merged [43056], [43062], [43063] to the 4.9 branch.
Fixes #43820.

Note: See TracTickets for help on using tickets.