From a28078fdaafb768125d0c07ad14fbd1465c9fdd1 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 9 Dec 2021 13:12:15 -0600 Subject: [PATCH] tags: fix tag category permissions in tag edit form. Fix the tag edit page letting users attempt to change a tag's category, even when the tag was too large for the user to change. Trying to change the category would fail, but with a confusing error message. --- app/views/tags/edit.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/tags/edit.html.erb b/app/views/tags/edit.html.erb index 9f499e755..08f98f2d8 100644 --- a/app/views/tags/edit.html.erb +++ b/app/views/tags/edit.html.erb @@ -3,10 +3,10 @@

Tag: <%= @tag.name %>

<%= edit_form_for(@tag) do |f| %> - <% if @tag.is_locked? %> -

This tag is category locked

+ <% if policy(@tag).can_change_category? %> + <%= f.input :category, collection: TagCategory.canonical_mapping.to_a, include_blank: false %> <% else %> - <%= f.input :category, :collection => TagCategory.canonical_mapping.to_a, :include_blank => false %> +

Create a <%= link_to "bulk update request", new_bulk_update_request_path(bulk_update_request: { script: "category #{@tag.name} -> general" }) %> to change this tag's category.

<% end %> <% if policy(@tag).can_lock? %>