From e8790724a0c513a614dc261b2a1f853e8348bb02 Mon Sep 17 00:00:00 2001 From: the-gorilla-steem <95911955+the-gorilla-steem@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:07:06 +0000 Subject: [PATCH] Bug Fix Fixed bug #3929 (View / Collapse Doesn't Work with 2 Pinned Posts) --- src/app/components/cards/PostsList.jsx | 72 ++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/src/app/components/cards/PostsList.jsx b/src/app/components/cards/PostsList.jsx index 946d3e6b17..0fbee86fed 100644 --- a/src/app/components/cards/PostsList.jsx +++ b/src/app/components/cards/PostsList.jsx @@ -38,6 +38,9 @@ class PostsList extends React.Component { blist: [], currentSlide: 0, arePinnedPostsCollapsed: false, + hideResteems: process.env.BROWSER + ? localStorage.getItem('hideResteems') === 'true' + : false, }; this.scrollListener = this.scrollListener.bind(this); this.onBackButton = this.onBackButton.bind(this); @@ -45,6 +48,9 @@ class PostsList extends React.Component { this.nextSlide = this.nextSlide.bind(this); this.prevSlide = this.prevSlide.bind(this); this.togglePinnedPosts = this.togglePinnedPosts.bind(this); + this.handleToggleHideResteems = this.handleToggleHideResteems.bind( + this + ); } componentDidMount() { @@ -192,6 +198,17 @@ class PostsList extends React.Component { ); } + handleToggleHideResteems() { + this.setState(prevState => { + const newHideResteems = !prevState.hideResteems; + if (process.env.BROWSER) { + localStorage.setItem('hideResteems', newHideResteems); + console.log('Storing HideResteems: ', newHideResteems); + } + return { hideResteems: newHideResteems }; + }); + } + render() { const { posts, @@ -201,8 +218,19 @@ class PostsList extends React.Component { nsfwPref, hideCategory, depth, + following, } = this.props; - const { thumbSize, currentSlide, arePinnedPostsCollapsed } = this.state; + const { + thumbSize, + currentSlide, + arePinnedPostsCollapsed, + hideResteems, + } = this.state; + + //console.log('Category: ', category); + //console.log('Order: ', order); + //console.log('Following: ', following); + //console.log('Hide Resteems', hideResteems); const pinnedPosts = posts.filter(post => post.getIn(['stats', 'is_pinned'], false) @@ -222,14 +250,21 @@ class PostsList extends React.Component { /> ); + //console.log('Author: ', post.get('author'), following.includes(post.get('author')), post.get('reblogged_by'), post.getIn(['stats', 'is_pinned'], false)); + const summary = []; summary.push(