FIX: notification reminder is deleted with bookmark (#35069)

Prior to this fix a user could delete a chat bookmark but the
notification reminder if it had already fired would still show in
notifications.
This commit is contained in:
Joffrey JAFFEUX
2025-10-01 11:58:31 +02:00
committed by GitHub
parent e171530e14
commit 74c60fef17
4 changed files with 141 additions and 3 deletions
@@ -103,6 +103,37 @@ RSpec.describe "Bookmark message", type: :system do
)
end
end
context "with reminder notification cleanup" do
it "removes bookmark reminder notification when bookmark is deleted" do
chat_page.visit_channel(category_channel_1)
channel_page.bookmark_message(message_1)
bookmark_modal.fill_name("Check this out later")
bookmark_modal.select_preset_reminder(:tomorrow)
expect(channel_page).to have_bookmarked_message(message_1)
bookmark = Bookmark.find_by(bookmarkable: message_1, user: current_user)
Chat::MessageBookmarkable.send_reminder_notification(
bookmark,
data: {
title: bookmark.bookmarkable.chat_channel.title(current_user),
bookmarkable_url: bookmark.bookmarkable.url,
},
)
user_menu.open
expect(page).to have_css("#quick-access-all-notifications .bookmark-reminder")
channel_page.bookmark_message(message_1)
bookmark_modal.delete
bookmark_modal.confirm_delete
user_menu.open
expect(page).to have_no_css("#quick-access-all-notifications .bookmark-reminder")
end
end
end
context "when mobile", mobile: true do