From 51008bc65defc6e1604a8dcf7a5f53d9040c1741 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Sun, 5 Jul 2020 19:52:56 -0400 Subject: [PATCH] Use scrollToIndex to contain scrollToLast --- js/src/forum/components/PostStream.js | 17 ----------------- js/src/forum/states/PostStreamState.js | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/js/src/forum/components/PostStream.js b/js/src/forum/components/PostStream.js index 87cefea29..e8d756f01 100644 --- a/js/src/forum/components/PostStream.js +++ b/js/src/forum/components/PostStream.js @@ -23,9 +23,6 @@ export default class PostStream extends Component { this.loadPageTimeouts = {}; this.pagesLoading = 0; - this.state.on('scrollToLast', () => { - this.scrollToLast(); - }); this.state.on('scrollToNumber', (number, noAnimation) => { this.scrollToNumber(number, noAnimation); }); @@ -276,20 +273,6 @@ export default class PostStream extends Component { return this.scrollToItem($item, noAnimation).done(this.flashItem.bind(this, $item)); } - scrollToLast() { - $('html,body') - .stop(true) - .animate( - { - scrollTop: $(document).height() - $(window).height(), - }, - 'fast', - () => { - this.flashItem(this.$('.PostStream-item:last-child')); - } - ); - } - /** * Scroll down to a certain post by index. * diff --git a/js/src/forum/states/PostStreamState.js b/js/src/forum/states/PostStreamState.js index 858037e83..3013ddd1c 100644 --- a/js/src/forum/states/PostStreamState.js +++ b/js/src/forum/states/PostStreamState.js @@ -58,7 +58,7 @@ class PostStreamState { // discussion and then scroll to the very bottom of the page. if (number === 'reply') { return this.goToLast().then(() => { - this.trigger('scrollToLast'); + this.trigger('scrollToIndex', this.count()); }); }