mirror of
https://github.com/flarum/framework.git
synced 2025-04-25 22:24:04 +08:00
Don't add duplicate posts to a discussion
This commit is contained in:
parent
823027b839
commit
1ff5e06525
@ -88,7 +88,7 @@ class PostStream extends mixin(Component, evented) {
|
|||||||
stream is not visible.
|
stream is not visible.
|
||||||
*/
|
*/
|
||||||
pushPost(post) {
|
pushPost(post) {
|
||||||
if (this.visibleEnd >= this.count() - 1) {
|
if (this.visibleEnd >= this.count() - 1 && this.posts.indexOf(post) === -1) {
|
||||||
this.posts.push(post);
|
this.posts.push(post);
|
||||||
this.visibleEnd++;
|
this.visibleEnd++;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,11 @@ class Discussion extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newData.links && newData.links.addedPosts) {
|
if (newData.links && newData.links.addedPosts) {
|
||||||
[].push.apply(posts.linkage, newData.links.addedPosts.linkage);
|
newData.links.addedPosts.linkage.forEach(linkage => {
|
||||||
|
if (posts.linkage[posts.linkage.length - 1].id != linkage.id) {
|
||||||
|
posts.linkage.push(linkage);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user