DEV: Add bookmark_id to bookmark reminder_handler notifications (#17547)

This is so we can join the Notification table onto the
Bookmark table. A slight refactor was needed to ensure
that the required values are always included and the
consumer does not need to think about this.

The discourse-chat and discourse-data-explorer plugins
will be updated to take advantage of this commit.
This commit is contained in:
Martin Brennan
2022-07-18 12:51:57 +10:00
committed by GitHub
parent 54e63b3d31
commit 0ca1152c1c
6 changed files with 100 additions and 12 deletions
+3 -5
View File
@@ -36,16 +36,14 @@ class TopicBookmarkable < BaseBookmarkable
end
def self.reminder_handler(bookmark)
bookmark.user.notifications.create!(
notification_type: Notification.types[:bookmark_reminder],
send_reminder_notification(
bookmark,
topic_id: bookmark.bookmarkable_id,
post_number: 1,
data: {
title: bookmark.bookmarkable.title,
display_username: bookmark.user.username,
bookmark_name: bookmark.name,
bookmarkable_url: bookmark.bookmarkable.first_post.url
}.to_json
}
)
end