From 70b917d7ae927a1779fd244c28ae4ab0d128ceb1 Mon Sep 17 00:00:00 2001 From: Gilbert Cherrie Date: Wed, 13 Mar 2024 09:37:07 -0400 Subject: [PATCH] Fixed bug with deleting group tags --- app/controllers/ops_controller/ops_rbac.rb | 3 ++- app/javascript/components/taggingWrapper.jsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/ops_controller/ops_rbac.rb b/app/controllers/ops_controller/ops_rbac.rb index c889e42c5be..b8f4f632288 100644 --- a/app/controllers/ops_controller/ops_rbac.rb +++ b/app/controllers/ops_controller/ops_rbac.rb @@ -1078,7 +1078,8 @@ def rbac_group_get_form_vars if params[:check] # User checked/unchecked a tree node if params[:tree_typ] == "tags" # MyCompany tag checked cat_name = Classification.find_by(:id => params[:cat]).name - tag_name = Classification.find_by(:id => params[:val]).name + classification = Classification.find_by(:id => params[:val]) + tag_name = classification ? classification.name : '' if params[:check] == "0" # unchecked @edit[:new][:filters].except!("#{cat_name}-#{tag_name}") # Remove the tag from the filters array else diff --git a/app/javascript/components/taggingWrapper.jsx b/app/javascript/components/taggingWrapper.jsx index 6ebe1abd644..f99515b7645 100644 --- a/app/javascript/components/taggingWrapper.jsx +++ b/app/javascript/components/taggingWrapper.jsx @@ -9,7 +9,7 @@ const selectedTags = (state, tag) => { return [state.tagging.appState.assignedTags.map((t) => t.values.map((val) => val.id)).flat(), selectedVal].flat(); }; -const params = (type = 'default', state, tag = {}) => ({ +const params = (type = 'default', state, tag = { tagCategory: undefined, tagValue: { id: undefined } }) => ({ provision: { id: 'new', ids_checked: selectedTags(state, tag), @@ -18,7 +18,7 @@ const params = (type = 'default', state, tag = {}) => ({ default: { id: state.tagging.appState.affectedItems[0] || 'new', cat: tag.tagCategory.id, - val: tag.tagValue.id || tag.tagValue[0].id, + val: tag.tagValue.id || tag.tagValue[0], check: 1, tree_typ: 'tags', },