FIX: Do not error _removeDeleteOnOwnerReplyBookmarks on navigate (#14426)
When creating a reply after already navigating out of the topic (e.g. open the reply composer, go to a different topic, then create the post), the _removeDeleteOnOwnerReplyBookmarks function was erroring because it relied on the topic model being present. We can skip this function altogether if the topic model is _not_ present, because the PostCreator already takes care of deleting bookmarks with the on_owner_reply auto_delete_preference. The _removeDeleteOnOwnerReplyBookmarks function just cleans up the in-memory post stream and topic model.
This commit is contained in:
parent
38b8eb5971
commit
57f17854fb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue