[Glitch] Add aliases for WebUI routes that were renamed in #16171

Port 11502ae46e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire 2021-09-27 07:23:48 +02:00
parent b2dd2e95ad
commit 188d66c9a8
6 changed files with 43 additions and 27 deletions

View file

@ -177,7 +177,7 @@ export function submitCompose(routerHistory) {
}, },
}).then(function (response) { }).then(function (response) {
if (routerHistory if (routerHistory
&& routerHistory.location.pathname === '/publish' && (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new')
&& window.history.state && window.history.state
&& !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) { && !getState().getIn(['compose', 'advanced_options', 'threaded_mode'])) {
routerHistory.goBack(); routerHistory.goBack();

View file

@ -2,7 +2,7 @@ import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { fetchAccount } from 'flavours/glitch/actions/accounts'; import { lookupAccount, fetchAccount } from 'flavours/glitch/actions/accounts';
import { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines'; import { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines';
import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
import Column from 'flavours/glitch/features/ui/components/column'; import Column from 'flavours/glitch/features/ui/components/column';
@ -16,8 +16,8 @@ import LoadMore from 'flavours/glitch/components/load_more';
import MissingIndicator from 'flavours/glitch/components/missing_indicator'; import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import { openModal } from 'flavours/glitch/actions/modal'; import { openModal } from 'flavours/glitch/actions/modal';
const mapStateToProps = (state, { params: { acct } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = state.getIn(['accounts_map', acct]); const accountId = id || state.getIn(['accounts_map', acct]);
if (!accountId) { if (!accountId) {
return { return {
@ -62,7 +62,8 @@ class AccountGallery extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.shape({ params: PropTypes.shape({
acct: PropTypes.string.isRequired, acct: PropTypes.string,
id: PropTypes.string,
}).isRequired, }).isRequired,
accountId: PropTypes.string, accountId: PropTypes.string,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
@ -79,8 +80,9 @@ class AccountGallery extends ImmutablePureComponent {
}; };
_load () { _load () {
const { accountId, dispatch } = this.props; const { accountId, isAccount, dispatch } = this.props;
if (!isAccount) dispatch(fetchAccount(accountId));
dispatch(expandAccountMediaTimeline(accountId)); dispatch(expandAccountMediaTimeline(accountId));
} }

View file

@ -19,8 +19,8 @@ import TimelineHint from 'flavours/glitch/components/timeline_hint';
const emptyList = ImmutableList(); const emptyList = ImmutableList();
const mapStateToProps = (state, { params: { acct }, withReplies = false }) => { const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) => {
const accountId = state.getIn(['accounts_map', acct]); const accountId = id || state.getIn(['accounts_map', acct]);
if (!accountId) { if (!accountId) {
return { return {
@ -56,7 +56,8 @@ class AccountTimeline extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.shape({ params: PropTypes.shape({
acct: PropTypes.string.isRequired, acct: PropTypes.string,
id: PropTypes.string,
}).isRequired, }).isRequired,
accountId: PropTypes.string, accountId: PropTypes.string,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,

View file

@ -6,6 +6,7 @@ import { debounce } from 'lodash';
import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
import { import {
lookupAccount, lookupAccount,
fetchAccount,
fetchFollowers, fetchFollowers,
expandFollowers, expandFollowers,
} from 'flavours/glitch/actions/accounts'; } from 'flavours/glitch/actions/accounts';
@ -19,8 +20,8 @@ import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import ScrollableList from 'flavours/glitch/components/scrollable_list'; import ScrollableList from 'flavours/glitch/components/scrollable_list';
import TimelineHint from 'flavours/glitch/components/timeline_hint'; import TimelineHint from 'flavours/glitch/components/timeline_hint';
const mapStateToProps = (state, { params: { acct } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = state.getIn(['accounts_map', acct]); const accountId = id || state.getIn(['accounts_map', acct]);
if (!accountId) { if (!accountId) {
return { return {
@ -52,7 +53,8 @@ class Followers extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.shape({ params: PropTypes.shape({
acct: PropTypes.string.isRequired, acct: PropTypes.string,
id: PropTypes.string,
}).isRequired, }).isRequired,
accountId: PropTypes.string, accountId: PropTypes.string,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
@ -66,8 +68,9 @@ class Followers extends ImmutablePureComponent {
}; };
_load () { _load () {
const { accountId, dispatch } = this.props; const { accountId, isAccount, dispatch } = this.props;
if (!isAccount) dispatch(fetchAccount(accountId));
dispatch(fetchFollowers(accountId)); dispatch(fetchFollowers(accountId));
} }

View file

@ -6,6 +6,7 @@ import { debounce } from 'lodash';
import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
import { import {
lookupAccount, lookupAccount,
fetchAccount,
fetchFollowing, fetchFollowing,
expandFollowing, expandFollowing,
} from 'flavours/glitch/actions/accounts'; } from 'flavours/glitch/actions/accounts';
@ -19,8 +20,8 @@ import MissingIndicator from 'flavours/glitch/components/missing_indicator';
import ScrollableList from 'flavours/glitch/components/scrollable_list'; import ScrollableList from 'flavours/glitch/components/scrollable_list';
import TimelineHint from 'flavours/glitch/components/timeline_hint'; import TimelineHint from 'flavours/glitch/components/timeline_hint';
const mapStateToProps = (state, { params: { acct } }) => { const mapStateToProps = (state, { params: { acct, id } }) => {
const accountId = state.getIn(['accounts_map', acct]); const accountId = id || state.getIn(['accounts_map', acct]);
if (!accountId) { if (!accountId) {
return { return {
@ -52,7 +53,8 @@ class Following extends ImmutablePureComponent {
static propTypes = { static propTypes = {
params: PropTypes.shape({ params: PropTypes.shape({
acct: PropTypes.string.isRequired, acct: PropTypes.string,
id: PropTypes.string,
}).isRequired, }).isRequired,
accountId: PropTypes.string, accountId: PropTypes.string,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
@ -66,8 +68,9 @@ class Following extends ImmutablePureComponent {
}; };
_load () { _load () {
const { accountId, dispatch } = this.props; const { accountId, isAccount, dispatch } = this.props;
if (!isAccount) dispatch(fetchAccount(accountId));
dispatch(fetchFollowing(accountId)); dispatch(fetchFollowing(accountId));
} }

View file

@ -200,10 +200,10 @@ class SwitchingColumnsArea extends React.PureComponent {
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} /> <WrappedRoute path='/getting-started' component={GettingStarted} content={children} />
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} /> <WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} />
<WrappedRoute path='/home' component={HomeTimeline} content={children} /> <WrappedRoute path={['/home', '/timelines/home']} component={HomeTimeline} content={children} />
<WrappedRoute path='/public' exact component={PublicTimeline} content={children} /> <WrappedRoute path={['/public', '/timelines/public']} exact component={PublicTimeline} content={children} />
<WrappedRoute path='/public/local' exact component={CommunityTimeline} content={children} /> <WrappedRoute path={['/public/local', '/timelines/public/local']} exact component={CommunityTimeline} content={children} />
<WrappedRoute path='/conversations' component={DirectTimeline} content={children} /> <WrappedRoute path={['/conversations', '/timelines/direct']} component={DirectTimeline} content={children} />
<WrappedRoute path='/tags/:id' component={HashtagTimeline} content={children} /> <WrappedRoute path='/tags/:id' component={HashtagTimeline} content={children} />
<WrappedRoute path='/lists/:id' component={ListTimeline} content={children} /> <WrappedRoute path='/lists/:id' component={ListTimeline} content={children} />
<WrappedRoute path='/notifications' component={Notifications} content={children} /> <WrappedRoute path='/notifications' component={Notifications} content={children} />
@ -215,17 +215,24 @@ class SwitchingColumnsArea extends React.PureComponent {
<WrappedRoute path='/start' component={FollowRecommendations} content={children} /> <WrappedRoute path='/start' component={FollowRecommendations} content={children} />
<WrappedRoute path='/search' component={Search} content={children} /> <WrappedRoute path='/search' component={Search} content={children} />
<WrappedRoute path='/directory' component={Directory} content={children} /> <WrappedRoute path='/directory' component={Directory} content={children} />
<WrappedRoute path='/publish' component={Compose} content={children} /> <WrappedRoute path={['/publish', '/statuses/new']} component={Compose} content={children} />
<WrappedRoute path='/@:acct' exact component={AccountTimeline} content={children} /> <WrappedRoute path={['/@:acct', '/accounts/:id']} exact component={AccountTimeline} content={children} />
<WrappedRoute path='/@:acct/with_replies' component={AccountTimeline} content={children} componentParams={{ withReplies: true }} /> <WrappedRoute path={['/@:acct/with_replies', '/accounts/:id/with_replies']} component={AccountTimeline} content={children} componentParams={{ withReplies: true }} />
<WrappedRoute path='/@:acct/followers' component={Followers} content={children} /> <WrappedRoute path={['/@:acct/followers', '/accounts/:id/followers']} component={Followers} content={children} />
<WrappedRoute path='/@:acct/following' component={Following} content={children} /> <WrappedRoute path={['/@:acct/following', '/accounts/:id/following']} component={Following} content={children} />
<WrappedRoute path='/@:acct/media' component={AccountGallery} content={children} /> <WrappedRoute path={['/@:acct/media', '/accounts/:id/media']} component={AccountGallery} content={children} />
<WrappedRoute path='/@:acct/:statusId' exact component={Status} content={children} /> <WrappedRoute path='/@:acct/:statusId' exact component={Status} content={children} />
<WrappedRoute path='/@:acct/:statusId/reblogs' component={Reblogs} content={children} /> <WrappedRoute path='/@:acct/:statusId/reblogs' component={Reblogs} content={children} />
<WrappedRoute path='/@:acct/:statusId/favourites' component={Favourites} content={children} /> <WrappedRoute path='/@:acct/:statusId/favourites' component={Favourites} content={children} />
{/* Legacy routes, cannot be easily factored with other routes because they share a param name */}
<WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} />
<WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} />
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} />
<WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} />
<WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} />
<WrappedRoute path='/follow_requests' component={FollowRequests} content={children} /> <WrappedRoute path='/follow_requests' component={FollowRequests} content={children} />
<WrappedRoute path='/blocks' component={Blocks} content={children} /> <WrappedRoute path='/blocks' component={Blocks} content={children} />
<WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} /> <WrappedRoute path='/domain_blocks' component={DomainBlocks} content={children} />