Skip to content

A platform for community discussion. Free, open, simple.

FIX: Do not error _removeDeleteOnOwnerReplyBookmarks on navigate (#14426)

Martin Brennan57f17854fb93
diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.js
index 42db37f14f6..8f83a5e8805 100644
--- a/app/assets/javascripts/discourse/app/controllers/topic.js
+++ b/app/assets/javascripts/discourse/app/controllers/topic.js
@@ -211,6 +211,14 @@ export default Controller.extend(bufferedProperty("model"), {
},
_removeDeleteOnOwnerReplyBookmarks() {
+ // the user has already navigated away from the topic. the PostCreator
+ // in rails already handles deleting the bookmarks that need to be
+ // based on auto_delete_preference; this is mainly used to clean up
+ // the in-memory post stream and topic model
+ if (!this.model) {
+ return;
+ }
+
const posts = this.get("model.postStream.posts");
if (posts) {
posts