WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.34k stars 4.13k forks source link

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

Closed ammist closed 6 years ago

ammist commented 7 years ago

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: https://github.com/WordPress/gutenberg/issues/1304

Todos

ammist commented 7 years ago

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 commented 7 years ago

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.

danielbachhuber commented 6 years ago

Closing in favor of https://github.com/WordPress/gutenberg/issues/5879#issuecomment-380990325