DEV: More events for filtered replies (#11511)

This commit is contained in:
Penar Musaraj 2020-12-16 12:11:01 -05:00 committed by GitHub
parent d1058f4e4c
commit 230fe0427e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 3 deletions

View File

@ -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}`);

View File

@ -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,
});
});
},
});

View File

@ -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
);
},
});

View File

@ -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();
});

View File

@ -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,