mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Fix date, index calculation on reload
This commit is contained in:
committed by
Franz Liedke
parent
ef206495cd
commit
875a1f70c1
@@ -125,7 +125,8 @@ class PostStreamState {
|
|||||||
show(posts) {
|
show(posts) {
|
||||||
this.visibleStart = posts.length ? this.discussion.postIds().indexOf(posts[0].id()) : 0;
|
this.visibleStart = posts.length ? this.discussion.postIds().indexOf(posts[0].id()) : 0;
|
||||||
this.visibleEnd = this.sanitizeIndex(this.visibleStart + posts.length);
|
this.visibleEnd = this.sanitizeIndex(this.visibleStart + posts.length);
|
||||||
this.index = (this.visibleEnd - this.visibleStart) / 2;
|
this.index = (this.visibleEnd + this.visibleStart) / 2;
|
||||||
|
this.description = posts.length ? dayjs(posts[Math.floor(posts.length / 2)].createdAt()).format('MMMM YYYY') : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +139,6 @@ class PostStreamState {
|
|||||||
reset(start, end) {
|
reset(start, end) {
|
||||||
this.visibleStart = start || 0;
|
this.visibleStart = start || 0;
|
||||||
this.visibleEnd = this.sanitizeIndex(end || this.constructor.loadCount);
|
this.visibleEnd = this.sanitizeIndex(end || this.constructor.loadCount);
|
||||||
this.index = (this.visibleEnd - this.visibleStart) / 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user