diff --git a/app/models/card.rb b/app/models/card.rb index c837c781a..c31029c79 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -58,6 +58,7 @@ class Card < ApplicationRecord def handle_collection_change transaction do + send_back_to_triage track_collection_change_event grant_access_to_assignees unless collection.all_access? end diff --git a/test/models/card_test.rb b/test/models/card_test.rb index 4694ab9ec..953b3ead1 100644 --- a/test/models/card_test.rb +++ b/test/models/card_test.rb @@ -129,6 +129,14 @@ class CardTest < ActiveSupport::TestCase assert_equal "Untitled", card.reload.title end + test "send back to triage when moved to a new collection" do + cards(:logo).update! column: columns(:writebook_in_progress) + + assert_changes -> { cards(:logo).reload.triaged? }, from: true, to: false do + cards(:logo).update! collection: collections(:private) + end + end + test "grants access to assignees when moved to a new collection" do card = cards(:logo) assignee = users(:david)