Fix: dismiss mention notifications in cards and comments when reading a card

This commit is contained in:
Jorge Manrubia
2025-04-24 12:17:04 +02:00
parent 1f8c6e3561
commit f166b30f2f
7 changed files with 72 additions and 4 deletions
+23
View File
@@ -0,0 +1,23 @@
require "test_helper"
class Card::ReadableTest < ActiveSupport::TestCase
test "read clears events notifications" do
assert_changes -> { notifications(:logo_published_kevin).reload.read? }, from: false, to: true do
assert_changes -> { notifications(:logo_assignment_kevin).reload.read? }, from: false, to: true do
cards(:logo).read_by(users(:kevin))
end
end
end
test "read clear mentions in the description" do
assert_changes -> { notifications(:logo_card_david_mention_by_jz).reload.read? }, from: false, to: true do
cards(:logo).read_by(users(:david))
end
end
test "read clear mentions in comments" do
assert_changes -> { notifications(:logo_comment_david_mention_by_jz).reload.read? }, from: false, to: true do
cards(:logo).read_by(users(:david))
end
end
end
+2
View File
@@ -6,6 +6,8 @@ class User::MentionableTest < ActiveSupport::TestCase
end
test "mentioned by" do
users(:david).mentions.destroy_all
assert_difference -> { users(:david).mentions.count }, +1 do
users(:david).mentioned_by users(:jz), at: cards(:logo)
end