mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 08:25:32 +08:00
Remove posts from the post stream by ID
This commit is contained in:
parent
5fad4acd76
commit
e9f0ef83b0
@ -57,7 +57,7 @@ export default class StreamContent extends mixin(Component, evented) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ondelete(post) {
|
ondelete(post) {
|
||||||
this.props.stream.removePost(post);
|
this.props.stream.removePost(post.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,10 +118,10 @@ export default class PostStream {
|
|||||||
this.content.push(this.makeItem(index, index, post))
|
this.content.push(this.makeItem(index, index, post))
|
||||||
}
|
}
|
||||||
|
|
||||||
removePost(post) {
|
removePost(id) {
|
||||||
this.ids.splice(this.ids.indexOf(post.id()), 1);
|
this.ids.splice(this.ids.indexOf(id), 1);
|
||||||
this.content.some((item, i) => {
|
this.content.some((item, i) => {
|
||||||
if (item.post === post) {
|
if (item.post && item.post.id() === id) {
|
||||||
this.content.splice(i, 1);
|
this.content.splice(i, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user