Merge remote-tracking branch 'origin/develop' into next
This commit is contained in:
commit
415e744ddb
4 changed files with 46 additions and 1 deletions
38
app/soapbox/features/share/index.js
Normal file
38
app/soapbox/features/share/index.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { changeCompose } from '../../actions/compose';
|
||||
import { openModal } from '../../actions/modal';
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
|
||||
onShare: (text) => {
|
||||
dispatch(openModal('COMPOSE'));
|
||||
dispatch(changeCompose(text));
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
export default @connect(null, mapDispatchToProps)
|
||||
class Share extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
onShare: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
const text = new URLSearchParams(window.location.search).get('text');
|
||||
if (text) this.props.onShare(text);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Redirect to='/' />
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -109,6 +109,7 @@ import {
|
|||
ModalContainer,
|
||||
ProfileHoverCard,
|
||||
RegisterInvite,
|
||||
Share,
|
||||
} from './util/async-components';
|
||||
|
||||
// Dummy import, to make sure that <Status /> ends up in the application bundle.
|
||||
|
@ -305,6 +306,8 @@ class SwitchingColumnsArea extends React.PureComponent {
|
|||
<WrappedRoute path='/donate/crypto' publicRoute page={DefaultPage} component={CryptoDonate} content={children} />
|
||||
<WrappedRoute path='/federation_restrictions' publicRoute page={DefaultPage} component={FederationRestrictions} content={children} />
|
||||
|
||||
<WrappedRoute path='/share' page={DefaultPage} component={Share} content={children} exact />
|
||||
|
||||
<WrappedRoute page={EmptyPage} component={GenericNotFound} content={children} />
|
||||
</Switch>
|
||||
);
|
||||
|
|
|
@ -409,3 +409,7 @@ export function FollowRecommendations() {
|
|||
export function RegisterInvite() {
|
||||
return import(/* webpackChunkName: "features/register_invite" */'../../register_invite');
|
||||
}
|
||||
|
||||
export function Share() {
|
||||
return import(/* webpackChunkName: "features/share" */'../../share');
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class WrappedRoute extends React.Component {
|
|||
const { component: Component, content, publicRoute, me, ...rest } = this.props;
|
||||
|
||||
if (!publicRoute && me === false) {
|
||||
const actualUrl = encodeURIComponent(this.props.computedMatch.url); // eslint-disable-line react/prop-types
|
||||
const actualUrl = encodeURIComponent(`${this.props.computedMatch.url}${this.props.location.search}`); // eslint-disable-line react/prop-types
|
||||
return <Redirect to={`/auth/sign_in?redirect_uri=${actualUrl}`} />;
|
||||
// return <Route path={this.props.path} component={() => {
|
||||
// window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`;
|
||||
|
|
Loading…
Reference in a new issue