A platform for community discussion. Free, open, simple.
FEATURE: Clear bookmark reminders from bookmark menu (#33168)
Martin Brennanc6d926eee7d6
diff --git a/app/assets/javascripts/discourse/app/components/bookmark-menu.gjs b/app/assets/javascripts/discourse/app/components/bookmark-menu.gjsindex 064edc774fa..70db8dbb669 100644--- a/app/assets/javascripts/discourse/app/components/bookmark-menu.gjs+++ b/app/assets/javascripts/discourse/app/components/bookmark-menu.gjs@@ -183,6 +183,26 @@ export default class BookmarkMenu extends Component {}}+ @action+ async onClearReminder() {+ try {+ this.existingBookmark.selectedReminderType = null;+ this.existingBookmark.selectedDatetime = null;+ this.existingBookmark.reminderAt = null;++ await this.bookmarkManager.save();++ this.toasts.success({+ duration: "short",+ data: { message: i18n("bookmarks.reminder_clear_success") },+ });+ } catch (error) {+ popupAjaxError(error);+ } finally {+ this.dMenu.close();+ }+ }+@actionasync onChooseReminderOption(option) {if (this.bookmarkCreatePromise) {@@ -268,6 +288,23 @@ export default class BookmarkMenu extends Component {class="bookmark-menu__row-btn btn-transparent"/></dropdown.item>++ {{#if this.existingBookmark.reminderAt}}+ <dropdown.item+ class="bookmark-menu__row --clear-reminder"+ role="button"+ tabindex="0"+ data-menu-option-id="clear-reminder"+ >+ <DButton+ @icon="bell-slash"+ @label="bookmarks.clear_reminder"+ @action={{this.onClearReminder}}+ class="bookmark-menu__row-btn btn-transparent"+ />+ </dropdown.item>+ {{/if}}+<dropdown.itemclass="bookmark-menu__row --remove"role="button"diff --git a/app/assets/stylesheets/common/components/bookmark-menu.scss b/app/assets/stylesheets/common/components/bookmark-menu.scssindex 49ae168fdfa..c58e209ee33 100644--- a/app/assets/stylesheets/common/components/bookmark-menu.scss+++ b/app/assets/stylesheets/common/components/bookmark-menu.scss@@ -29,6 +29,12 @@background: var(--danger-low);}}++ &.--clear-reminder {+ .d-icon {+ color: var(--primary-low-mid);+ }+ }}.bookmark-menu__row-title {diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 8388ab75d52..2902f949bbd 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -431,9 +431,11 @@ en:bookmarked_success: "Bookmarked!"deleted_bookmark_success: "Bookmark deleted!"reminder_set_success: "Reminder set!"+ reminder_clear_success: "Reminder cleared"created: "You've bookmarked this post. %{name}"created_generic: "You've bookmarked this. %{name}"create: "Create bookmark"+ clear_reminder: "Clear reminder"edit: "Edit bookmark"not_bookmarked: "bookmark this post"remove_reminder_keep_bookmark: "Remove reminder and keep bookmark"diff --git a/spec/system/bookmarks_spec.rb b/spec/system/bookmarks_spec.rbindex f1064c06a48..64221d70420 100644--- a/spec/system/bookmarks_spec.rb+++ b/spec/system/bookmarks_spec.rb@@ -162,6 +162,14 @@ describe "Bookmarking posts and topics", type: :system doexpect(topic_page).to have_no_post_bookmarked(post_2)end+ it "can clear the bookmark reminder" do+ visit_topic_and_open_bookmark_menu(post_2, expand_actions: false)+ bookmark_menu.click_menu_option("clear-reminder")+ expect(page).to have_content(I18n.t("js.bookmarks.reminder_clear_success"))+ expect(topic_page).to have_post_bookmarked(post_2, with_reminder: false)+ expect(bookmark.reload.reminder_at).to be_nil+ end+it "can delete the bookmark from within the menu" dovisit_topic_and_open_bookmark_menu(post_2, expand_actions: false)bookmark_menu.click_menu_option("delete")