diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 3b3ebcb5b..40d566d24 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -158,7 +158,7 @@ export function submitCompose(routerHistory) { 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), }, }).then(function (response) { - if (routerHistory && routerHistory.location.pathname === '/publish' && window.history.state) { + if (routerHistory && (routerHistory.location.pathname === '/publish' || routerHistory.location.pathname === '/statuses/new') && window.history.state) { routerHistory.goBack(); } diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.js index ef6e7c8f7..cc0bfa9ba 100644 --- a/app/javascript/mastodon/features/account_gallery/index.js +++ b/app/javascript/mastodon/features/account_gallery/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { lookupAccount } from 'mastodon/actions/accounts'; +import { lookupAccount, fetchAccount } from 'mastodon/actions/accounts'; import { expandAccountMediaTimeline } from '../../actions/timelines'; import LoadingIndicator from 'mastodon/components/loading_indicator'; import Column from '../ui/components/column'; @@ -17,8 +17,8 @@ import MissingIndicator from 'mastodon/components/missing_indicator'; import { openModal } from 'mastodon/actions/modal'; import { FormattedMessage } from 'react-intl'; -const mapStateToProps = (state, { params: { acct } }) => { - const accountId = state.getIn(['accounts_map', acct]); +const mapStateToProps = (state, { params: { acct, id } }) => { + const accountId = id || state.getIn(['accounts_map', acct]); if (!accountId) { return { @@ -64,7 +64,8 @@ class AccountGallery extends ImmutablePureComponent { static propTypes = { params: PropTypes.shape({ - acct: PropTypes.string.isRequired, + acct: PropTypes.string, + id: PropTypes.string, }).isRequired, accountId: PropTypes.string, dispatch: PropTypes.func.isRequired, @@ -82,8 +83,9 @@ class AccountGallery extends ImmutablePureComponent { }; _load () { - const { accountId, dispatch } = this.props; + const { accountId, isAccount, dispatch } = this.props; + if (!isAccount) dispatch(fetchAccount(accountId)); dispatch(expandAccountMediaTimeline(accountId)); } diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/mastodon/features/account_timeline/index.js index 8ca768373..20f1dba9f 100644 --- a/app/javascript/mastodon/features/account_timeline/index.js +++ b/app/javascript/mastodon/features/account_timeline/index.js @@ -20,8 +20,8 @@ import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines' const emptyList = ImmutableList(); -const mapStateToProps = (state, { params: { acct }, withReplies = false }) => { - const accountId = state.getIn(['accounts_map', acct]); +const mapStateToProps = (state, { params: { acct, id }, withReplies = false }) => { + const accountId = id || state.getIn(['accounts_map', acct]); if (!accountId) { return { @@ -58,7 +58,8 @@ class AccountTimeline extends ImmutablePureComponent { static propTypes = { params: PropTypes.shape({ - acct: PropTypes.string.isRequired, + acct: PropTypes.string, + id: PropTypes.string, }).isRequired, accountId: PropTypes.string, dispatch: PropTypes.func.isRequired, diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.js b/app/javascript/mastodon/features/direct_timeline/components/conversation.js index c4f7098c5..77ff2ce7b 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.js @@ -81,7 +81,7 @@ class Conversation extends ImmutablePureComponent { markRead(); } - this.context.router.history.push(`/statuses/${lastStatus.get('id')}`); + this.context.router.history.push(`/@${lastStatus.getIn(['account', 'acct'])}/${lastStatus.get('id')}`); } handleMarkAsRead = () => { diff --git a/app/javascript/mastodon/features/follow_recommendations/components/account.js b/app/javascript/mastodon/features/follow_recommendations/components/account.js index bd855aab0..ffc0ab00c 100644 --- a/app/javascript/mastodon/features/follow_recommendations/components/account.js +++ b/app/javascript/mastodon/features/follow_recommendations/components/account.js @@ -66,7 +66,7 @@ class Account extends ImmutablePureComponent { return (
- +
diff --git a/app/javascript/mastodon/features/follow_recommendations/index.js b/app/javascript/mastodon/features/follow_recommendations/index.js index 26c8b2471..b5a71aef5 100644 --- a/app/javascript/mastodon/features/follow_recommendations/index.js +++ b/app/javascript/mastodon/features/follow_recommendations/index.js @@ -68,7 +68,7 @@ class FollowRecommendations extends ImmutablePureComponent { } })); - router.history.push('/timelines/home'); + router.history.push('/home'); } render () { diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js index 3193ce322..224e74b3d 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/mastodon/features/followers/index.js @@ -7,6 +7,7 @@ import { debounce } from 'lodash'; import LoadingIndicator from '../../components/loading_indicator'; import { lookupAccount, + fetchAccount, fetchFollowers, expandFollowers, } from '../../actions/accounts'; @@ -19,8 +20,8 @@ import ScrollableList from '../../components/scrollable_list'; import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; -const mapStateToProps = (state, { params: { acct } }) => { - const accountId = state.getIn(['accounts_map', acct]); +const mapStateToProps = (state, { params: { acct, id } }) => { + const accountId = id || state.getIn(['accounts_map', acct]); if (!accountId) { return { @@ -53,7 +54,8 @@ class Followers extends ImmutablePureComponent { static propTypes = { params: PropTypes.shape({ - acct: PropTypes.string.isRequired, + acct: PropTypes.string, + id: PropTypes.string, }).isRequired, accountId: PropTypes.string, dispatch: PropTypes.func.isRequired, @@ -68,8 +70,9 @@ class Followers extends ImmutablePureComponent { }; _load () { - const { accountId, dispatch } = this.props; + const { accountId, isAccount, dispatch } = this.props; + if (!isAccount) dispatch(fetchAccount(accountId)); dispatch(fetchFollowers(accountId)); } diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index d26ada277..aadce1644 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -7,6 +7,7 @@ import { debounce } from 'lodash'; import LoadingIndicator from '../../components/loading_indicator'; import { lookupAccount, + fetchAccount, fetchFollowing, expandFollowing, } from '../../actions/accounts'; @@ -19,8 +20,8 @@ import ScrollableList from '../../components/scrollable_list'; import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; -const mapStateToProps = (state, { params: { acct } }) => { - const accountId = state.getIn(['accounts_map', acct]); +const mapStateToProps = (state, { params: { acct, id } }) => { + const accountId = id || state.getIn(['accounts_map', acct]); if (!accountId) { return { @@ -53,7 +54,8 @@ class Following extends ImmutablePureComponent { static propTypes = { params: PropTypes.shape({ - acct: PropTypes.string.isRequired, + acct: PropTypes.string, + id: PropTypes.string, }).isRequired, accountId: PropTypes.string, dispatch: PropTypes.func.isRequired, @@ -68,8 +70,9 @@ class Following extends ImmutablePureComponent { }; _load () { - const { accountId, dispatch } = this.props; + const { accountId, isAccount, dispatch } = this.props; + if (!isAccount) dispatch(fetchAccount(accountId)); dispatch(fetchFollowing(accountId)); } diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js index 651675c19..193637113 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -53,7 +53,7 @@ const messages = defineMessages({ publish: { id: 'compose_form.publish', defaultMessage: 'Toot' }, }); -const shouldHideFAB = path => path.match(/^\/statuses\/|^\/search|^\/getting-started|^\/start/); +const shouldHideFAB = path => path.match(/^\/statuses\/|^\/@[^/]+\/\d+|^\/publish|^\/search|^\/getting-started|^\/start/); export default @(component => injectIntl(component, { withRef: true })) class ColumnsArea extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index af8d62826..3feffa656 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -154,10 +154,10 @@ class SwitchingColumnsArea extends React.PureComponent { - - - - + + + + @@ -169,17 +169,24 @@ class SwitchingColumnsArea extends React.PureComponent { - + - - - - - + + + + + + {/* Legacy routes, cannot be easily factored with other routes because they share a param name */} + + + + + +