mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:31:56 +08:00
DEV: More events for filtered replies (#11511)
This commit is contained in:
parent
d1058f4e4c
commit
230fe0427e
|
@ -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}`);
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user