A platform for community discussion. Free, open, simple.
DEV: Review fixes for bookmark-list (#10642)
Martin Brennan40d5739a8007
diff --git a/app/assets/javascripts/discourse/app/components/bookmark-list.js b/app/assets/javascripts/discourse/app/components/bookmark-list.jsindex 637b72b7122..546b9bf5e33 100644--- a/app/assets/javascripts/discourse/app/components/bookmark-list.js+++ b/app/assets/javascripts/discourse/app/components/bookmark-list.js@@ -1,4 +1,5 @@import Component from "@ember/component";+import { Promise } from "rsvp";import I18n from "I18n";import { action } from "@ember/object";import showModal from "discourse/lib/show-modal";@@ -13,18 +14,28 @@ export default Component.extend({@actionremoveBookmark(bookmark) {- const deleteBookmark = () => {- return bookmark- .destroy()- .then(() => this._removeBookmarkFromList(bookmark));- };- if (!bookmark.reminder_at) {- return deleteBookmark();- }- bootbox.confirm(I18n.t("bookmarks.confirm_delete"), (result) => {- if (result) {+ return new Promise((resolve, reject) => {+ const deleteBookmark = () => {+ bookmark+ .destroy()+ .then(() => {+ this._removeBookmarkFromList(bookmark);+ resolve(true);+ })+ .catch((error) => {+ reject(error);+ });+ };+ if (!bookmark.reminder_at) {return deleteBookmark();}+ bootbox.confirm(I18n.t("bookmarks.confirm_delete"), (result) => {+ if (result) {+ deleteBookmark();+ } else {+ resolve(false);+ }+ });});},@@ -50,9 +61,7 @@ export default Component.extend({title: "post.bookmarks.edit",modalClass: "bookmark-with-reminder",});- controller.setProperties({- afterSave: () => this.reload(),- });+ controller.set("afterSave", () => this.reload());},_removeBookmarkFromList(bookmark) {