FIX: Show deleted bookmark reminders in user bookmarks menu (#25905)

When we send a bookmark reminder, there is an option to delete
the underlying bookmark. The Notification record stays around.
However, if you want to filter your notifications user menu
to only bookmark-based notifications, we were not showing unread
bookmark notifications for deleted bookmarks.

This commit fixes the issue _going forward_ by adding the
bookmarkable_id and bookmarkable_type to the Notification data,
so we can look up the underlying Post/Topic/Chat::Message
for a deleted bookmark and check user access in this way. Then,
it doesn't matter if the bookmark was deleted.
This commit is contained in:
Martin Brennan
2024-02-29 09:03:49 +10:00
committed by GitHub
parent dbc72aaca9
commit df4197c8b8
11 changed files with 134 additions and 13 deletions

View File

@@ -42,6 +42,8 @@ RSpec.describe BaseBookmarkable do
display_username: bookmark.user.username,
bookmark_name: bookmark.name,
bookmark_id: bookmark.id,
bookmarkable_type: bookmark.bookmarkable_type,
bookmarkable_id: bookmark.bookmarkable_id,
}.to_json,
)
end

View File

@@ -126,6 +126,8 @@ RSpec.describe PostBookmarkable do
display_username: bookmark1.user.username,
bookmark_name: bookmark1.name,
bookmark_id: bookmark1.id,
bookmarkable_type: bookmark1.bookmarkable_type,
bookmarkable_id: bookmark1.bookmarkable_id,
}.to_json,
)
end

View File

@@ -122,6 +122,8 @@ RSpec.describe TopicBookmarkable do
display_username: bookmark1.user.username,
bookmark_name: bookmark1.name,
bookmark_id: bookmark1.id,
bookmarkable_type: bookmark1.bookmarkable_type,
bookmarkable_id: bookmark1.bookmarkable_id,
}.to_json,
)
end