diff --git a/app/actions/views/root.js b/app/actions/views/root.js index b152a34a4..11cdf78de 100644 --- a/app/actions/views/root.js +++ b/app/actions/views/root.js @@ -97,6 +97,7 @@ export function loadFromPushNotification(notification, isInitialNotification) { } dispatch(handleSelectTeamAndChannel(teamId, channelId)); + dispatch(selectPost('')); const {root_id: rootId} = notification.payload || {}; if (isCollapsedThreadsEnabled(state) && rootId) { diff --git a/app/screens/channel/channel_base.js b/app/screens/channel/channel_base.js index 0cc07980e..e29adb542 100644 --- a/app/screens/channel/channel_base.js +++ b/app/screens/channel/channel_base.js @@ -37,6 +37,7 @@ export default class ChannelBase extends PureComponent { showTermsOfService: PropTypes.bool, skipMetrics: PropTypes.bool, viewingGlobalThreads: PropTypes.bool, + collapsedThreadsEnabled: PropTypes.bool.isRequired, selectedPost: PropTypes.shape({ id: PropTypes.string.isRequired, channel_id: PropTypes.string.isRequired, @@ -199,7 +200,7 @@ export default class ChannelBase extends PureComponent { loadChannels = (teamId) => { const {loadChannelsForTeam, selectInitialChannel} = this.props.actions; if (EphemeralStore.getStartFromNotification()) { - if (this.props.selectedPost) { + if (this.props.selectedPost && this.props.collapsedThreadsEnabled) { EventEmitter.emit('goToThread', this.props.selectedPost); } // eslint-disable-next-line no-console diff --git a/app/screens/channel/channel_base.test.js b/app/screens/channel/channel_base.test.js index ba0fb154f..31a4b58a9 100644 --- a/app/screens/channel/channel_base.test.js +++ b/app/screens/channel/channel_base.test.js @@ -26,6 +26,7 @@ describe('ChannelBase', () => { }, componentId: channelBaseComponentId, theme: Preferences.THEMES.denim, + collapsedThreadsEnabled: false, }; const optionsForTheme = (theme) => { return { diff --git a/app/screens/channel/index.js b/app/screens/channel/index.js index d98cf0382..65a4ab8c6 100644 --- a/app/screens/channel/index.js +++ b/app/screens/channel/index.js @@ -40,6 +40,7 @@ function mapStateToProps(state) { const currentTeamId = currentTeam?.delete_at === 0 ? currentTeam?.id : ''; const currentChannelId = currentTeam?.delete_at === 0 ? getCurrentChannelId(state) : ''; + const collapsedThreadsEnabled = isCollapsedThreadsEnabled(state); return { currentChannelId, @@ -48,10 +49,11 @@ function mapStateToProps(state) { isSupportedServer, isSystemAdmin, selectedPost: getSelectedPost(state), + collapsedThreadsEnabled, showTermsOfService: shouldShowTermsOfService(state), teamName: currentTeam?.display_name, theme: getTheme(state), - viewingGlobalThreads: isCollapsedThreadsEnabled(state) && getViewingGlobalThreads(state), + viewingGlobalThreads: collapsedThreadsEnabled && getViewingGlobalThreads(state), }; }