diff --git a/app/components/admin/permissions/permissions_list_row_component.html.erb b/app/components/admin/permissions/permissions_list_row_component.html.erb index c7c339d1b..a6e69a08e 100644 --- a/app/components/admin/permissions/permissions_list_row_component.html.erb +++ b/app/components/admin/permissions/permissions_list_row_component.html.erb @@ -1,4 +1,4 @@ <%= render Admin::Permissions::TagComponent.new(@tag_group.tag) %> -<%= button_to admin_tag_group_path(@tag_group), method: :delete do %> +<%= button_to admin_tenant_tag_group_path(Current.tenant, @tag_group), method: :delete do %> <%= render Common::DeleteButtonComponent.new %> <% end %> diff --git a/app/components/common/tag_selector_popup_component.rb b/app/components/common/tag_selector_popup_component.rb index 62191f3ad..0c1e53440 100644 --- a/app/components/common/tag_selector_popup_component.rb +++ b/app/components/common/tag_selector_popup_component.rb @@ -2,7 +2,11 @@ module Common class TagSelectorPopupComponent < ViewComponent::Base def initialize(object) @object = object - @tags = policy_scope(Tag).where.not(id: object.tags.ids).where(visible: true) + # TODO: Toto bude treba tiez prestahovat niekam inam. Len je to zas hlboko + @tags = Current.tenant.tags.where.not(id: object.tags.ids).where(visible: true) + .where(id: TagGroup.select(:tag_id).joins(:group, :tag, group: :users) + .where(group: { tenant_id: Current.tenant.id }, tag: { tenant_id: Current.tenant.id }, users: { id: Current.user.id }) + ) end end end diff --git a/app/models/box.rb b/app/models/box.rb index eaf02793c..39597e12f 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -17,6 +17,8 @@ class Box < ApplicationRecord has_many :message_threads, through: :folders, extend: MessageThreadsExtensions has_many :message_drafts_imports + before_create { self.color = Box.colors.keys[Digest::MD5.hexdigest(name).to_i(16) % Box.colors.size] if color.blank? } + enum :color, { slate: 'slate', @@ -40,6 +42,6 @@ class Box < ApplicationRecord purple: 'purple', fuchsia: 'fuchsia', pink: 'pink', - rose: 'rose', + rose: 'rose' } end