mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Don't add duplicate posts to a discussion
This commit is contained in:
parent
da461b1be7
commit
cf7b6974bc
|
@ -88,7 +88,7 @@ class PostStream extends mixin(Component, evented) {
|
|||
stream is not visible.
|
||||
*/
|
||||
pushPost(post) {
|
||||
if (this.visibleEnd >= this.count() - 1) {
|
||||
if (this.visibleEnd >= this.count() - 1 && this.posts.indexOf(post) === -1) {
|
||||
this.posts.push(post);
|
||||
this.visibleEnd++;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,11 @@ class Discussion extends Model {
|
|||
}
|
||||
|
||||
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…
Reference in New Issue
Block a user