mirror of
https://github.com/flarum/core.git
synced 2025-07-21 08:41:17 +02:00
Don't add duplicate posts to a discussion
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user