Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image block dialogue missing "Mine", "Uploaded to this post", "Unattached" filters #19851

Open
EvanLTD opened this issue Jan 23, 2020 · 14 comments
Labels
[Feature] Media Anything that impacts the experience of managing media Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.

Comments

@EvanLTD
Copy link

EvanLTD commented Jan 23, 2020

When inserting an image via an Image Block, the dropdown menu of filter options is missing from the Select or Upload Media window. This is exactly the same problem as the now-resolved issue 8748, except this one pertains to images inserted via the regular image block rather than the Featured Image dialog: https://github.com/WordPress/gutenberg/issues/8748

To Reproduce

  1. Create a Post
  2. Insert an Image Block
  3. Click the Media Library button within the block
  4. Note that in the Select or Upload Media window, below the Filter Media heading, one of the dropdown menus is missing. (There should be one with options for "Images, Uploaded to this post, Mine, Unattached.")

Note that when inserting images via a Gallery Block, or via the Featured Image dialog, this filter dropdown menu DOES appear correctly. The Image Block should be made consistent with those.

Gutenberg Version 7.3.0
WP 5.3.2

How it looks now (screenshot from inserting image via Image Block:

image

### How it should look (screenshot from inserting Gallery or Featured Image):

image

@jorgefilipecosta jorgefilipecosta added [Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement. labels Jan 23, 2020
@epiqueras
Copy link
Contributor

Shouldn't this be done in Core @jorgefilipecosta?

@jorgefilipecosta
Copy link
Member

Hi @epiqueras, the core provides the media library UI to this UI. I think The WordPress components that interact with the core media library are the place where we can address this issue.

@epiqueras
Copy link
Contributor

The way #8748 was fixed was by creating a custom modal. Shouldn't this be in the default modal exposed by Core?

@jorgefilipecosta
Copy link
Member

The way #8748 was fixed was by creating a custom modal. Shouldn't this be in the default modal exposed by Core?

I'm not sure maybe the interface core exposes allows to enable these filters with just a flag. I will cc @joemcgill, @anthonyburchell in case they are able to provide some insights.

@anthonyburchell
Copy link
Contributor

Yeah for some context here on how things were before Gutenberg, here's a screenshot of the image block equivalent flow in Classic Editor (Add Media) :

Screen Shot 2020-02-21 at 4 04 49 PM

The changes to make this available in the image block flows would be similar to the changes in #8748. Worth noting, this would also need to be solved for inline images.

@FuSan21
Copy link

FuSan21 commented Jun 23, 2020

@anthonyburchell @epiqueras Any fix on this? It seems still not touched and isn't assigned to anyone.

@torounit
Copy link
Member

torounit commented Jul 3, 2020

related: #12753

@tiagogon
Copy link

Is this planned for anytime soon?

@noisysocks
Copy link
Member

Reported here as well: https://core.trac.wordpress.org/ticket/48797

@noisysocks noisysocks added the Needs Dev Ready for, and needs developer efforts label Nov 5, 2020
@ssakcoR
Copy link

ssakcoR commented May 8, 2021

"Uploaded to this post" is susch a time saver! This hasn't been solved still! :/

However, it doesn't appear when creating a "Gallery" block. On a single image it doesn't. I doesn't make much sense creating a gallery block for one image only...

@matthewmcvickar
Copy link

matthewmcvickar commented Jun 14, 2021

Any idea when this might be addressed?

@dnnsjsk
Copy link

dnnsjsk commented Jun 23, 2021

Yikes just came across this.

Any way this can be fixed in the meantime?

@dnnsjsk
Copy link

dnnsjsk commented Jun 23, 2021

Hey, this filter seems to work for me. My conditions are a bit different, but you can probably adjust it to your needs.

add_filter(
    'ajax_query_attachments_args',
    function ($query = []) {
        $user_id = get_current_user_id();
        if ($user_id && current_user_can('contributor')) {
            $query['author'] = $user_id;
        }
        return $query;
    },
    10,
    1
);

@netinial
Copy link

netinial commented Nov 1, 2022

It seems this issue has been resolved at
#17410

However we confirm issue repeats again.

Changing Theme to default.
Disabling all Plugins does not works.

Image block dialogue missing Filter Media as "Mine", "Uploaded to this post", "Unattached" filters

Any chance to check issue again?

@dnnsjsk we could not applied your solution
Do you have any chance to help us?

add_filter(
    'ajax_query_attachments_args',
    function ($query = []) {
        $user_id = get_current_user_id();
        if ($user_id && current_user_can('contributor')) {
            $query['author'] = $user_id;
        }
        return $query;
    },
    10,
    1
);

my $query

add_filter(
    'ajax_query_attachments_args',
    function ($query = []) {
        press($query);
    },
    10,
    1
);

returns as follow

Array
(
    [orderby] => date
    [order] => DESC
    [posts_per_page] => 80
    [paged] => 1
    [post_type] => attachment
    [post_status] => inherit,private
)

What is the logic to add $query['author'] = $user_id;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests