Skip to content

Commit

Permalink
Fixes based on manual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stage-rl committed Sep 18, 2023
1 parent 2259084 commit 13679bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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 %>
6 changes: 5 additions & 1 deletion app/components/common/tag_selector_popup_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion app/models/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -40,6 +42,6 @@ class Box < ApplicationRecord
purple: 'purple',
fuchsia: 'fuchsia',
pink: 'pink',
rose: 'rose',
rose: 'rose'
}
end

0 comments on commit 13679bf

Please sign in to comment.