DEV: adds a topic level bookmark toggle (#14471)
This commit is contained in:
parent
4285706d97
commit
20e70d0ac5
|
@ -1217,6 +1217,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||||
onAfterSave: () => {
|
onAfterSave: () => {
|
||||||
this.model.set("bookmarked", true);
|
this.model.set("bookmarked", true);
|
||||||
this.model.incrementProperty("bookmarksWereChanged");
|
this.model.incrementProperty("bookmarksWereChanged");
|
||||||
|
this.appEvents.trigger("topic:bookmark-toggled");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -384,7 +384,13 @@ const Topic = RestModel.extend({
|
||||||
}
|
}
|
||||||
this.set(
|
this.set(
|
||||||
"bookmarks",
|
"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.set("bookmarked", this.bookmarks.length);
|
||||||
this.incrementProperty("bookmarksWereChanged");
|
this.incrementProperty("bookmarksWereChanged");
|
||||||
|
|
Loading…
Reference in New Issue