From a48b7d1ab53937cb1edf4ba0c22d72bca31082e4 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 18 Jul 2022 13:40:24 +1000 Subject: [PATCH] DEV: Bookmarkable reminder refinement (#183) Incorporates changes from core https://github.com/discourse/discourse/commit/0ca1152c1cc36f5fb23af1ccedfb6678fea1f8f3 --- .discourse-compatibility | 1 + lib/data_explorer_query_group_bookmarkable.rb | 8 +++----- spec/lib/data_explorer_query_group_bookmarkable_spec.rb | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.discourse-compatibility b/.discourse-compatibility index fb72979..6916ecd 100644 --- a/.discourse-compatibility +++ b/.discourse-compatibility @@ -1,3 +1,4 @@ +2.9.0.beta7: 272e9dd760f82e33f9756866434ddcbe470cdb8e 2.9.0.beta2: e7c19ac107dcd37618c7ac7b98530e99c7fe31db 2.8.0.beta3: 23287ece952cb45203819e7b470ebc194c58cb13 2.7.7: 23287ece952cb45203819e7b470ebc194c58cb13 diff --git a/lib/data_explorer_query_group_bookmarkable.rb b/lib/data_explorer_query_group_bookmarkable.rb index b38d72b..40693f4 100644 --- a/lib/data_explorer_query_group_bookmarkable.rb +++ b/lib/data_explorer_query_group_bookmarkable.rb @@ -34,14 +34,12 @@ class DataExplorerQueryGroupBookmarkable < BaseBookmarkable end def self.reminder_handler(bookmark) - bookmark.user.notifications.create!( - notification_type: Notification.types[:bookmark_reminder], + send_reminder_notification( + bookmark, data: { title: bookmark.bookmarkable.query.name, - display_username: bookmark.user.username, - bookmark_name: bookmark.name, bookmarkable_url: "/g/#{bookmark.bookmarkable.group.name}/reports/#{bookmark.bookmarkable.query.id}" - }.to_json + } ) end diff --git a/spec/lib/data_explorer_query_group_bookmarkable_spec.rb b/spec/lib/data_explorer_query_group_bookmarkable_spec.rb index 11429ab..27388c0 100644 --- a/spec/lib/data_explorer_query_group_bookmarkable_spec.rb +++ b/spec/lib/data_explorer_query_group_bookmarkable_spec.rb @@ -112,9 +112,10 @@ describe DataExplorerQueryGroupBookmarkable do expect(notif.data).to eq( { title: bookmark1.bookmarkable.query.name, + bookmarkable_url: "/g/#{bookmark1.bookmarkable.group.name}/reports/#{bookmark1.bookmarkable.query.id}", display_username: bookmark1.user.username, bookmark_name: bookmark1.name, - bookmarkable_url: "/g/#{bookmark1.bookmarkable.group.name}/reports/#{bookmark1.bookmarkable.query.id}" + bookmark_id: bookmark1.id }.to_json ) end