From dbf410e34c324f05a53e50ab640cdc0fea2adca6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 5 Oct 2021 17:24:01 -0500 Subject: [PATCH] Messages: prefer DirectTimeline, but fall back to Conversations --- app/soapbox/features/ui/index.js | 7 ++++--- app/soapbox/utils/features.js | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/ui/index.js b/app/soapbox/features/ui/index.js index 15aaf930f..2b32f01e3 100644 --- a/app/soapbox/features/ui/index.js +++ b/app/soapbox/features/ui/index.js @@ -177,6 +177,7 @@ class SwitchingColumnsArea extends React.PureComponent { location: PropTypes.object, onLayoutChange: PropTypes.func.isRequired, soapbox: ImmutablePropTypes.map.isRequired, + features: PropTypes.object.isRequired, }; state = { @@ -205,7 +206,7 @@ class SwitchingColumnsArea extends React.PureComponent { } render() { - const { children, soapbox } = this.props; + const { children, soapbox, features } = this.props; const authenticatedProfile = soapbox.get('authenticatedProfile'); return ( @@ -221,7 +222,7 @@ class SwitchingColumnsArea extends React.PureComponent { - + {/* @@ -686,7 +687,7 @@ class UI extends React.PureComponent {
- + {children} diff --git a/app/soapbox/utils/features.js b/app/soapbox/utils/features.js index 4db3dbf6b..a8a2ec7cd 100644 --- a/app/soapbox/utils/features.js +++ b/app/soapbox/utils/features.js @@ -1,5 +1,6 @@ // Detect backend features to conditionally render elements import gte from 'semver/functions/gte'; +import lt from 'semver/functions/lt'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; import { createSelector } from 'reselect'; @@ -30,6 +31,14 @@ export const getFeatures = createSelector([ v.software === MASTODON && gte(v.compatVersion, '3.1.3'), v.software === PLEROMA && gte(v.version, '2.1.0'), ]), + directTimeline: any([ + v.software === MASTODON && lt(v.compatVersion, '3.0.0'), + v.software === PLEROMA && gte(v.version, '0.9.9'), + ]), + conversations: any([ + v.software === MASTODON && gte(v.compatVersion, '2.6.0'), + v.software === PLEROMA && gte(v.version, '0.9.9'), + ]), emojiReacts: v.software === PLEROMA && gte(v.version, '2.0.0'), emojiReactsRGI: v.software === PLEROMA && gte(v.version, '2.2.49'), attachmentLimit: v.software === PLEROMA ? Infinity : 4,