FIX: ensures tag-groups are used to allow category edit on topics (#7141)

This commit is contained in:
Joffrey JAFFEUX
2019-03-11 15:02:27 +01:00
committed by GitHub
parent d6eb892b04
commit 7ae1afa7d9
2 changed files with 30 additions and 5 deletions

View File

@@ -290,7 +290,9 @@ class TopicsController < ApplicationController
end
if category && topic_tags = (params[:tags] || topic.tags.pluck(:name))
allowed_tags = category.tags.pluck(:name)
category_tags = category.tags.pluck(:name)
category_tag_groups = category.tag_groups.joins(:tags).pluck("tags.name")
allowed_tags = (category_tags + category_tag_groups).uniq
if topic_tags.present? && allowed_tags.present?
invalid_tags = topic_tags - allowed_tags