From 1fc76acf063d0a96bac6a8c85af0e5c025f39162 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sun, 2 Aug 2020 07:56:58 +0200 Subject: [PATCH] Stop injecting post stream state into scrubber --- js/src/forum/components/DiscussionPage.js | 2 +- js/src/forum/components/PostStreamScrubber.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/js/src/forum/components/DiscussionPage.js b/js/src/forum/components/DiscussionPage.js index fb3e068e6..04ffa23b4 100644 --- a/js/src/forum/components/DiscussionPage.js +++ b/js/src/forum/components/DiscussionPage.js @@ -282,7 +282,7 @@ export default class DiscussionPage extends Page { items.add( 'scrubber', PostStreamScrubber.component({ - stream: this.stream, + discussion: this.discussion, className: 'App-titleControl', onNavigate: this.stream.goToIndex.bind(this.stream), count: this.stream.count(), diff --git a/js/src/forum/components/PostStreamScrubber.js b/js/src/forum/components/PostStreamScrubber.js index b73f9f5bd..4599ce5c2 100644 --- a/js/src/forum/components/PostStreamScrubber.js +++ b/js/src/forum/components/PostStreamScrubber.js @@ -10,7 +10,7 @@ import formatNumber from '../../common/utils/formatNumber'; * * ### Props * - * - `stream` + * - `discussion` * - `className` * - `onNavigate` * - `count` @@ -21,7 +21,6 @@ import formatNumber from '../../common/utils/formatNumber'; */ export default class PostStreamScrubber extends Component { init() { - this.stream = this.props.stream; this.handlers = {}; // Define a handler to update the state of the scrollbar to reflect the @@ -38,7 +37,7 @@ export default class PostStreamScrubber extends Component { view() { const retain = this.subtree.retain(); const { count, index, visible } = this.props; - const unreadCount = this.stream.discussion.unreadCount(); + const unreadCount = this.props.discussion.unreadCount(); const unreadPercent = count ? Math.min(count - this.props.index, unreadCount) / count : 0; const viewing = app.translator.transChoice('core.forum.post_scrubber.viewing_text', count, {