mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
Fix edge cases where posts would not be added/removed
This commit is contained in:
parent
57df38e85a
commit
026e6361e5
|
@ -87,7 +87,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.push(post);
|
this.posts.push(post);
|
||||||
this.visibleEnd++;
|
this.visibleEnd++;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class PostStream extends mixin(Component, evented) {
|
||||||
*/
|
*/
|
||||||
removePost(id) {
|
removePost(id) {
|
||||||
this.posts.some((item, i) => {
|
this.posts.some((item, i) => {
|
||||||
if (item && item.id() === id) {
|
if (item && item.id() == id) {
|
||||||
this.posts.splice(i, 1);
|
this.posts.splice(i, 1);
|
||||||
this.visibleEnd--;
|
this.visibleEnd--;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user