From fdc90eb5386e42e96f5723aaf123a0573d243b8a Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 29 May 2025 22:09:23 -0500 Subject: [PATCH] Grant access to assignees when changing collections --- app/models/card.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/card.rb b/app/models/card.rb index 69588ea88..744e8744c 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -12,6 +12,7 @@ class Card < ApplicationRecord has_rich_text :description before_save :set_default_title, if: :published? + after_save :grant_access_to_assignees, if: :saved_change_to_collection_id? scope :reverse_chronologically, -> { order created_at: :desc, id: :desc } scope :chronologically, -> { order created_at: :asc, id: :asc } @@ -39,4 +40,9 @@ class Card < ApplicationRecord def set_default_title self.title = "Untitled" if title.blank? end + + def grant_access_to_assignees + return if collection.all_access? + collection.accesses.grant_to(assignees) + end end