diff --git a/app/assets/javascripts/discourse/app/models/post-stream.js b/app/assets/javascripts/discourse/app/models/post-stream.js index 810f6a33037..80fe6b2a640 100644 --- a/app/assets/javascripts/discourse/app/models/post-stream.js +++ b/app/assets/javascripts/discourse/app/models/post-stream.js @@ -251,12 +251,13 @@ export default RestModel.extend({ return this.refreshAndJumptoSecondVisible(); }, - filterReplies(postNumber) { + filterReplies(postNumber, postId) { this.cancelFilter(); this.set("filterRepliesToPostNumber", postNumber); this.appEvents.trigger("post-stream:filter-replies", { topic_id: this.get("topic.id"), post_number: postNumber, + post_id: postId, }); return this.refresh({ refreshInPlace: true }).then(() => { const element = document.querySelector(`#post_${postNumber}`); diff --git a/app/assets/javascripts/discourse/app/widgets/post-gap.js b/app/assets/javascripts/discourse/app/widgets/post-gap.js index d1a3b060f48..6fc769bbe47 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-gap.js +++ b/app/assets/javascripts/discourse/app/widgets/post-gap.js @@ -29,6 +29,9 @@ export default createWidget("post-gap", { args ).then(() => { state.loading = false; + this.appEvents.trigger("post-stream:gap-expanded", { + post_id: this.model.id, + }); }); }, }); diff --git a/app/assets/javascripts/discourse/app/widgets/post-stream.js b/app/assets/javascripts/discourse/app/widgets/post-stream.js index 8b26c816795..d0f45a907c2 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-stream.js +++ b/app/assets/javascripts/discourse/app/widgets/post-stream.js @@ -175,6 +175,10 @@ createWidget("filter-show-all", { click() { this.sendWidgetAction("cancelFilter", this.attrs.streamFilters); + this.appEvents.trigger( + "post-stream:filter-show-all", + this.attrs.streamFilters + ); }, }); diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js index 6ee54ebbc87..e90befbc421 100644 --- a/app/assets/javascripts/discourse/app/widgets/post.js +++ b/app/assets/javascripts/discourse/app/widgets/post.js @@ -439,7 +439,7 @@ createWidget("post-contents", { const controller = this.register.lookup("controller:topic"); post .get("topic.postStream") - .filterReplies(this.attrs.post_number) + .filterReplies(post.post_number, post.id) .then(() => { controller.updateQueryParams(); }); diff --git a/app/assets/javascripts/discourse/tests/unit/models/post-stream-test.js b/app/assets/javascripts/discourse/tests/unit/models/post-stream-test.js index 1a5c4b4b945..78151c33552 100644 --- a/app/assets/javascripts/discourse/tests/unit/models/post-stream-test.js +++ b/app/assets/javascripts/discourse/tests/unit/models/post-stream-test.js @@ -320,7 +320,7 @@ module("Unit | Model | post-stream", function () { "by default no replies are filtered" ); - postStream.filterReplies(3); + postStream.filterReplies(3, 2); assert.equal( postStream.get("filterRepliesToPostNumber"), 3,