FEATURE: Add "delete on owner reply" bookmark functionality (#10231)

This adds an option to "delete on owner reply" to bookmarks. If you select this option in the modal, then reply to the topic the bookmark is in, the bookmark will be deleted on reply.

This PR also changes the checkboxes for these additional bookmark options to an Integer column in the DB with a combobox to select the option you want.

The use cases are:

* Sometimes I will bookmark the topics to read it later. In this case we definitely don’t need to keep the bookmark after I replied to it.
* Sometimes I will read the topic in mobile and I will prefer to reply in PC later. Or I may have to do some research before reply. So I will bookmark it for reply later.
This commit is contained in:
Martin Brennan
2020-07-21 10:00:39 +10:00
committed by GitHub
parent 949c8923a4
commit 41b43a2a25
19 changed files with 178 additions and 73 deletions

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class AddDeleteOptionToBookmarks < ActiveRecord::Migration[6.0]
def up
add_column :bookmarks, :auto_delete_preference, :integer, index: true, null: false, default: 0
DB.exec("UPDATE bookmarks SET auto_delete_preference = 1 WHERE delete_when_reminder_sent")
end
def down
remove_column :bookmarks, :auto_delete_preference
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class RemoveBookmarksDeleteWhenReminderSent < ActiveRecord::Migration[6.0]
def up
remove_column :bookmarks, :delete_when_reminder_sent
end
def down
add_column :bookmarks, :delete_when_reminder_sent, :boolean, default: false
end
end