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

Can't add new tag using Gutenberg editor (just regular post editor/quick edit) #2545

Closed
ammist opened this Issue Aug 27, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@ammist

ammist commented Aug 27, 2017

Issue Overview

Logged in as a user with "author" permissions. Created a new post with Gutenberg. Tried to add new tag (one that is new for the blog) in Gutenberg. The new tag briefly flashes, and disappears. It is not saved after clicking update.

Went to the list of posts. Did "Quick Edit". Added a new tag, which was saved. When I went into Guternberg, I was able to see the tag. I can even "delete" it, but, when I update the post, the old tag remains on the post.

We tried this in Firefox, Safari, and Chrome - the same behavior persisted.

Steps to Reproduce (for bugs)

  1. Log as a user with "author" permissions.
  2. Create or edit a post with Gutenberg
  3. Open the "Categories/Tags" sidebar metabox. Add a new tag (one that doesn't exist on the blog already)
  4. Notice that it doesn't save.

Expected Behavior

When an author creates a new tag using Gutenberg, that tag should be saved with their post.
When an author removes a tag using Gutenberg, that tag should be removed from the post.

Current Behavior

Possible Solution

Related Issues and/or PRs

Maybe related: #1304

Todos

  • Tests
  • Documentation
@ammist

This comment has been minimized.

ammist commented Aug 27, 2017

Here's a screenshare of the behavior, showing that we can't add or remove tags using the Gutenerg editor.

2017-08-27_12-34-07

@aduth

This comment has been minimized.

Member

aduth commented Aug 28, 2017

This is an interesting one, since the current editor doesn't seem to really respect the capabilities for adding terms. For example, as a contributor, I can add a new tag for a post in the current editor, despite the fact that contributors should not have this right:

I believe the issue can be tracked back to this logic, which checks the assign_terms capability instead (more permissive, as edit_posts):

Which appears to be tied into this Trac issue:

Because Gutenberg tries to create these terms using the REST API endpoint, and the endpoint checks the edit_terms capability, the request will fail.

Given the above Trac issue, it's unclear whether moving forward we should want to respect the capability for managing terms before giving the user the option to create a new tag, since there is some conflicting feedback on whether this is intentional.

  • If yes: Update the editor interface to omit behaviors around creating tags if user cannot manage terms
  • If no: Update the WP_REST_Terms_Controller to check the assign_terms capability of non-hierarchical taxonomies
    • In this case, we'd still want to check the assign_terms capability
@danielbachhuber

This comment has been minimized.

Member

danielbachhuber commented Apr 13, 2018

Closing in favor of #5879 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment