DEV: adds a topic level bookmark toggle (#14471)

DEV: adds a topic level bookmark toggle (#14471)

diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.js
index 97ff99b..e6556e9 100644
--- a/app/assets/javascripts/discourse/app/controllers/topic.js
+++ b/app/assets/javascripts/discourse/app/controllers/topic.js
@@ -1217,6 +1217,7 @@ export default Controller.extend(bufferedProperty("model"), {
       onAfterSave: () => {
         this.model.set("bookmarked", true);
         this.model.incrementProperty("bookmarksWereChanged");
+        this.appEvents.trigger("topic:bookmark-toggled");
       },
     });
   },
diff --git a/app/assets/javascripts/discourse/app/models/topic.js b/app/assets/javascripts/discourse/app/models/topic.js
index 66c7f68..262bc8c 100644
--- a/app/assets/javascripts/discourse/app/models/topic.js
+++ b/app/assets/javascripts/discourse/app/models/topic.js
@@ -384,7 +384,13 @@ const Topic = RestModel.extend({
     }
     this.set(
       "bookmarks",
-      this.bookmarks.filter((bookmark) => bookmark.id !== id)
+      this.bookmarks.filter((bookmark) => {
+        if (bookmark.id === id && bookmark.for_topic) {
+          this.appEvents.trigger("topic:bookmark-toggled");
+        }
+
+        return bookmark.id !== id;
+      })
     );
     this.set("bookmarked", this.bookmarks.length);
     this.incrementProperty("bookmarksWereChanged");

GitHub sha: 20e70d0ac5febfeee6c6cc0a83881a79422bba57

This commit appears in #14471 which was approved by ZogStriP. It was merged by jjaffeux.

This commit has been mentioned on Discourse Meta. There might be relevant details there: