From c4c906eb0c56692d9018eec6b86e01dfaa6563b1 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 14 Oct 2025 16:04:18 +0200 Subject: [PATCH] [Glitch] Fix error in logged-out hashtag view when remote posts require log-in Port 3232eee358134ca468b40ec3b517a15fe69b7fe6 to glitch-soc Signed-off-by: Claire --- .../features/hashtag_timeline/index.jsx | 32 +++++++++++-------- .../flavours/glitch/initial_state.ts | 4 +++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx index 48335488f0..c2c453aa37 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx @@ -16,15 +16,21 @@ import { expandHashtagTimeline, clearTimeline } from 'flavours/glitch/actions/ti import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context'; +import { remoteTopicFeedAccess, me } from 'flavours/glitch/initial_state'; import StatusListContainer from '../ui/containers/status_list_container'; import { HashtagHeader } from './components/hashtag_header'; import ColumnSettingsContainer from './containers/column_settings_container'; -const mapStateToProps = (state, props) => ({ - hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${props.params.local ? ':local' : ''}`, 'unread']) > 0, -}); +const mapStateToProps = (state, props) => { + const local = props.params.local || (!me && remoteTopicFeedAccess !== 'public'); + + return ({ + local, + hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${local ? ':local' : ''}`, 'unread']) > 0, + }); +}; class HashtagTimeline extends PureComponent { disconnects = []; @@ -113,16 +119,16 @@ class HashtagTimeline extends PureComponent { } _unload () { - const { dispatch } = this.props; - const { id, local } = this.props.params; + const { dispatch, local } = this.props; + const { id } = this.props.params; this._unsubscribe(); dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`)); } _load() { - const { dispatch } = this.props; - const { id, tags, local } = this.props.params; + const { dispatch, local } = this.props; + const { id, tags } = this.props.params; this._subscribe(dispatch, id, tags, local); dispatch(expandHashtagTimeline(id, { tags, local })); @@ -133,8 +139,8 @@ class HashtagTimeline extends PureComponent { } componentDidUpdate (prevProps) { - const { params } = this.props; - const { id, tags, local } = prevProps.params; + const { params, local } = this.props; + const { id, tags } = prevProps.params; if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) { this._unload(); @@ -151,15 +157,15 @@ class HashtagTimeline extends PureComponent { }; handleLoadMore = maxId => { - const { dispatch, params } = this.props; - const { id, tags, local } = params; + const { dispatch, params, local } = this.props; + const { id, tags } = params; dispatch(expandHashtagTimeline(id, { maxId, tags, local })); }; render () { - const { hasUnread, columnId, multiColumn } = this.props; - const { id, local } = this.props.params; + const { hasUnread, columnId, multiColumn, local } = this.props; + const { id } = this.props.params; const pinned = !!columnId; return ( diff --git a/app/javascript/flavours/glitch/initial_state.ts b/app/javascript/flavours/glitch/initial_state.ts index 926cfbe1c2..06d78125bb 100644 --- a/app/javascript/flavours/glitch/initial_state.ts +++ b/app/javascript/flavours/glitch/initial_state.ts @@ -36,6 +36,8 @@ interface InitialStateMeta { streaming_api_base_url: string; local_live_feed_access: 'public' | 'authenticated'; remote_live_feed_access: 'public' | 'authenticated'; + local_topic_feed_access: 'public' | 'authenticated'; + remote_topic_feed_access: 'public' | 'authenticated'; title: string; show_trends: boolean; trends_as_landing_page: boolean; @@ -141,6 +143,8 @@ export const singleUserMode = getMeta('single_user_mode'); export const source_url = getMeta('source_url'); export const localLiveFeedAccess = getMeta('local_live_feed_access'); export const remoteLiveFeedAccess = getMeta('remote_live_feed_access'); +export const localTopicFeedAccess = getMeta('local_topic_feed_access'); +export const remoteTopicFeedAccess = getMeta('remote_topic_feed_access'); export const title = getMeta('title'); export const trendsAsLanding = getMeta('trends_as_landing_page'); export const useBlurhash = getMeta('use_blurhash');