mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FEATURE: Optionally delete bookmark when reminder sent (#9637)
We now show an options gear icon next to the bookmark name. When expanded we show the "delete bookmark when reminder sent" option. The value of this checkbox is saved in local storage for the user. If this is ticked, when a reminder is sent for the bookmark the bookmark itself is deleted. This is so people can use the reminder functionality by itself. Also remove the blue alert reminder section from the "Edit Bookmark" modal as it just added clutter, because the user can already see they had a reminder set: Adds a default false boolean column `delete_when_reminder_sent` to bookmarks.
This commit is contained in:
@ -42,6 +42,17 @@ RSpec.describe BookmarkManager do
|
||||
end
|
||||
end
|
||||
|
||||
context "when options are provided" do
|
||||
let(:options) { { delete_when_reminder_sent: true } }
|
||||
|
||||
it "saves any additional options successfully" do
|
||||
subject.create(post_id: post.id, name: name, options: options)
|
||||
bookmark = Bookmark.find_by(user: user)
|
||||
|
||||
expect(bookmark.delete_when_reminder_sent).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "when the bookmark already exists for the user & post" do
|
||||
before do
|
||||
Bookmark.create(post: post, user: user, topic: post.topic)
|
||||
@ -142,14 +153,19 @@ RSpec.describe BookmarkManager do
|
||||
let(:new_name) { "Some new name" }
|
||||
let(:new_reminder_at) { 10.days.from_now }
|
||||
let(:new_reminder_type) { Bookmark.reminder_types[:custom] }
|
||||
let(:options) { {} }
|
||||
|
||||
def update_bookmark
|
||||
subject.update(
|
||||
bookmark_id: bookmark.id, name: new_name, reminder_type: new_reminder_type, reminder_at: new_reminder_at
|
||||
bookmark_id: bookmark.id,
|
||||
name: new_name,
|
||||
reminder_type: new_reminder_type,
|
||||
reminder_at: new_reminder_at,
|
||||
options: options
|
||||
)
|
||||
end
|
||||
|
||||
it "saves the time and new reminder type sucessfully" do
|
||||
it "saves the time and new reminder type and new name sucessfully" do
|
||||
update_bookmark
|
||||
bookmark.reload
|
||||
expect(bookmark.name).to eq(new_name)
|
||||
@ -157,6 +173,16 @@ RSpec.describe BookmarkManager do
|
||||
expect(bookmark.reminder_type).to eq(new_reminder_type)
|
||||
end
|
||||
|
||||
context "when options are provided" do
|
||||
let(:options) { { delete_when_reminder_sent: true } }
|
||||
|
||||
it "saves any additional options successfully" do
|
||||
update_bookmark
|
||||
bookmark.reload
|
||||
expect(bookmark.delete_when_reminder_sent).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "if the new reminder type is a string" do
|
||||
let(:new_reminder_type) { "custom" }
|
||||
it "is parsed" do
|
||||
|
Reference in New Issue
Block a user