mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +02:00
update: forum/states/PostStreamState
- Change m.deferred to native promise
This commit is contained in:
committed by
Franz Liedke
parent
ed3b923f58
commit
79f5291f04
@@ -47,7 +47,7 @@ class PostStreamState {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
update() {
|
update() {
|
||||||
if (!this.viewingEnd()) return m.deferred().resolve().promise;
|
if (!this.viewingEnd()) return Promise.resolve();
|
||||||
|
|
||||||
this.visibleEnd = this.count();
|
this.visibleEnd = this.count();
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ class PostStreamState {
|
|||||||
*/
|
*/
|
||||||
loadNearNumber(number) {
|
loadNearNumber(number) {
|
||||||
if (this.posts().some((post) => post && Number(post.number()) === Number(number))) {
|
if (this.posts().some((post) => post && Number(post.number()) === Number(number))) {
|
||||||
return m.deferred().resolve().promise;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
@@ -157,7 +157,7 @@ class PostStreamState {
|
|||||||
*/
|
*/
|
||||||
loadNearIndex(index) {
|
loadNearIndex(index) {
|
||||||
if (index >= this.visibleStart && index <= this.visibleEnd) {
|
if (index >= this.visibleStart && index <= this.visibleEnd) {
|
||||||
return m.deferred().resolve().promise;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = this.sanitizeIndex(index - this.constructor.loadCount / 2);
|
const start = this.sanitizeIndex(index - this.constructor.loadCount / 2);
|
||||||
@@ -266,7 +266,7 @@ class PostStreamState {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return loadIds.length ? app.store.find('posts', loadIds) : m.deferred().resolve(loaded).promise;
|
return loadIds.length ? app.store.find('posts', loadIds) : Promise.resolve(loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user