Messages: prefer DirectTimeline, but fall back to Conversations

merge-requests/784/head
Alex Gleason 3 years ago
parent a1512316d8
commit dbf410e34c
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -177,6 +177,7 @@ class SwitchingColumnsArea extends React.PureComponent {
location: PropTypes.object, location: PropTypes.object,
onLayoutChange: PropTypes.func.isRequired, onLayoutChange: PropTypes.func.isRequired,
soapbox: ImmutablePropTypes.map.isRequired, soapbox: ImmutablePropTypes.map.isRequired,
features: PropTypes.object.isRequired,
}; };
state = { state = {
@ -205,7 +206,7 @@ class SwitchingColumnsArea extends React.PureComponent {
} }
render() { render() {
const { children, soapbox } = this.props; const { children, soapbox, features } = this.props;
const authenticatedProfile = soapbox.get('authenticatedProfile'); const authenticatedProfile = soapbox.get('authenticatedProfile');
return ( return (
@ -221,7 +222,7 @@ class SwitchingColumnsArea extends React.PureComponent {
<WrappedRoute path='/timeline/fediverse' exact page={HomePage} component={PublicTimeline} content={children} publicRoute /> <WrappedRoute path='/timeline/fediverse' exact page={HomePage} component={PublicTimeline} content={children} publicRoute />
<WrappedRoute path='/timeline/:instance' exact page={RemoteInstancePage} component={RemoteTimeline} content={children} /> <WrappedRoute path='/timeline/:instance' exact page={RemoteInstancePage} component={RemoteTimeline} content={children} />
<WrappedRoute path='/conversations' page={DefaultPage} component={Conversations} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> <WrappedRoute path='/conversations' page={DefaultPage} component={Conversations} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
<WrappedRoute path='/messages' page={DefaultPage} component={DirectTimeline} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} /> <WrappedRoute path='/messages' page={DefaultPage} component={features.directTimeline ? DirectTimeline : Conversations} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
{/* {/*
<WrappedRoute path='/groups' exact page={GroupsPage} component={Groups} content={children} componentParams={{ activeTab: 'featured' }} /> <WrappedRoute path='/groups' exact page={GroupsPage} component={Groups} content={children} componentParams={{ activeTab: 'featured' }} />
@ -686,7 +687,7 @@ class UI extends React.PureComponent {
<div className={classnames} ref={this.setRef} style={style}> <div className={classnames} ref={this.setRef} style={style}>
<TabsBar /> <TabsBar />
<SwitchingColumnsArea location={location} onLayoutChange={this.handleLayoutChange} soapbox={soapbox}> <SwitchingColumnsArea location={location} onLayoutChange={this.handleLayoutChange} soapbox={soapbox} features={features}>
{children} {children}
</SwitchingColumnsArea> </SwitchingColumnsArea>

@ -1,5 +1,6 @@
// Detect backend features to conditionally render elements // Detect backend features to conditionally render elements
import gte from 'semver/functions/gte'; import gte from 'semver/functions/gte';
import lt from 'semver/functions/lt';
import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
@ -30,6 +31,14 @@ export const getFeatures = createSelector([
v.software === MASTODON && gte(v.compatVersion, '3.1.3'), v.software === MASTODON && gte(v.compatVersion, '3.1.3'),
v.software === PLEROMA && gte(v.version, '2.1.0'), 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'), emojiReacts: v.software === PLEROMA && gte(v.version, '2.0.0'),
emojiReactsRGI: v.software === PLEROMA && gte(v.version, '2.2.49'), emojiReactsRGI: v.software === PLEROMA && gte(v.version, '2.2.49'),
attachmentLimit: v.software === PLEROMA ? Infinity : 4, attachmentLimit: v.software === PLEROMA ? Infinity : 4,

Loading…
Cancel
Save