1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 16:07:34 +02:00

Remove obsolete properties in post stream state

This commit is contained in:
Franz Liedke
2020-08-02 08:01:55 +02:00
parent 1fc76acf06
commit bad8115a4a

View File

@@ -20,23 +20,6 @@ class PostStreamState {
this.loadPageTimeouts = {}; this.loadPageTimeouts = {};
this.pagesLoading = 0; this.pagesLoading = 0;
this.index = 0;
this.number = 1;
/**
* The number of posts that are currently visible in the viewport.
*
* @type {Number}
*/
this.visible = 1;
/**
* The description to render on the scrubber.
*
* @type {String}
*/
this.description = '';
this.show(includedPosts); this.show(includedPosts);
} }
@@ -89,18 +72,15 @@ class PostStreamState {
this.paused = true; this.paused = true;
this.loadPromise = this.loadNearNumber(number);
this.targetPost = { number }; this.targetPost = { number };
this.noAnimationScroll = noAnimation; this.noAnimationScroll = noAnimation;
this.number = number;
// In this case, the redraw is only called after the response has been loaded // In this case, the redraw is only called after the response has been loaded
// because we need to know the indices of the post range before we can // because we need to know the indices of the post range before we can
// start scrolling to items. Calling redraw early causes issues. // start scrolling to items. Calling redraw early causes issues.
// Since this is only used for external navigation to the post stream, the delay // Since this is only used for external navigation to the post stream, the delay
// before the stream is moved is not an issue. // before the stream is moved is not an issue.
return this.loadPromise.then(() => { return this.loadNearNumber(number).then(() => {
this.paused = false; this.paused = false;
m.redraw(); m.redraw();
}); });
@@ -116,7 +96,7 @@ class PostStreamState {
goToIndex(index, noAnimation = false) { goToIndex(index, noAnimation = false) {
this.paused = true; this.paused = true;
this.loadPromise = this.loadNearIndex(index); const promise = this.loadNearIndex(index);
this.targetPost = { index }; this.targetPost = { index };
this.noAnimationScroll = noAnimation; this.noAnimationScroll = noAnimation;
@@ -124,7 +104,7 @@ class PostStreamState {
m.redraw(); m.redraw();
return this.loadPromise.then(() => (this.paused = false)); return promise.then(() => (this.paused = false));
} }
/** /**
@@ -319,16 +299,6 @@ class PostStreamState {
return this.discussion.postIds().length; return this.discussion.postIds().length;
} }
/**
* Check whether or not the scrubber should be disabled, i.e. if all of the
* posts are visible in the viewport.
*
* @return {Boolean}
*/
disabled() {
return this.visible >= this.count();
}
/** /**
* Are we currently viewing the end of the discussion? * Are we currently viewing the end of the discussion?
* *