Editing post with tags without tagging permission results in tag removal

Summary: So the discourse I moderate uses tags, and both the creation and application of tags is limited to TL4 users. Essentially that is just the moderator, admins, and a few long time trustable users. Unfortunately, it seems that if a user edits the OP after a TL4 users has applied tags, the tags are removed.

Steps to reproduce: (using names to make it clearer)

  1. Bob, not a TL4 user creates a post.
  2. Joe, a TL4 user edits the title to include proper tags.
  3. Bob makes an edit to the OP.

Expected Results:
Bob’s edits affect only the post content, tags remain attached.

Actual Results:
Bob’s edits take effect AND remove any tags from the topic.

Notes:
Unable to attempt repro on try as all users can tag…

Attachments:
See this unlisted topic from my site where I recreated the bug. Notice the 2 edits…
http://discourse.stonehearth.net/t/moderator-tagging-test-v6/17938 (text to prevent oneboxing…)

3 Likes

Makes sense from a code perspective – that user does not have the right to add those tags. So thus at the time that user saves the post, those ineligible tags are removed. The special case is that tags predating your edit should not be permission checked against the current user.

I remember encountering these cases on Stack Exchange with moderator tags as well @neil.

I understand that from a permission basis within the code it makes sense,…that doesn’t mean it makes sense from a human/end-user perspective. Was this special case resolved over on Stack Exchange?

As I said above

Perhaps that was unclear?

Sorry, no that was very clear. My intention was to agree with your comment.

My question was referring to your use of the word “should.” Agreeing that this should be resolved does not mean it was resolved previously.

We will get it fixed, already have code that protects moderator tags, that is an even tricker case to protect against

4 Likes

What is a “moderator tag?” I am a moderator…

A tag that only a moderator can apply

Eg Topics tagged planned

You need to be an admin to define the list

So we would have to “pre-define” every tag…that would work for almost every tag we use, except for the tag we create for each version…would need an admin to add it every time they release a patch.

Thanks for the info, looking forward to a fix! :smile:

I committed the fix for this. In this case, the post revisor should not be attempting to change the tags at all, so it was a simple fix.

https://github.com/discourse/discourse-tagging/commit/1c0ff4dc6642c69cc777e99de357095fac66ceb4

4 Likes