diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 9e0b12370484e3..61e226d0a499bf 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -119,12 +119,14 @@ export function cycleElefriendCompose() { }; } -export function replyCompose(status, routerHistory) { +export function replyCompose(status, routerHistory, statusRebloggedBy) { return (dispatch, getState) => { const prependCWRe = getState().getIn(['local_settings', 'prepend_cw_re']); + const mentionReblogger = getState().getIn(['local_settings', 'mention_reblogger']); dispatch({ type: COMPOSE_REPLY, status: status, + statusRebloggedBy: mentionReblogger ? statusRebloggedBy : undefined, prependCWRe: prependCWRe, }); diff --git a/app/javascript/flavours/glitch/containers/status_container.js b/app/javascript/flavours/glitch/containers/status_container.js index 1f4b982addea00..c67c6e88ce7062 100644 --- a/app/javascript/flavours/glitch/containers/status_container.js +++ b/app/javascript/flavours/glitch/containers/status_container.js @@ -92,11 +92,16 @@ const makeMapStateToProps = () => { return mapStateToProps; }; -const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ +const mapDispatchToProps = (dispatch, ownProps) => ({ onReply (status, router) { + const getStatus = makeGetStatus(); + dispatch((_, getState) => { + const { intl } = ownProps; let state = getState(); + const statusFromState = getStatus(state, ownProps); + const rebloggedBy = statusFromState.get('reblog') ? statusFromState.get('account') : undefined; if (state.getIn(['local_settings', 'confirm_before_clearing_draft']) && state.getIn(['compose', 'text']).trim().length !== 0) { dispatch(openModal({ @@ -105,11 +110,11 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ message: intl.formatMessage(messages.replyMessage), confirm: intl.formatMessage(messages.replyConfirm), onDoNotAsk: () => dispatch(changeLocalSetting(['confirm_before_clearing_draft'], false)), - onConfirm: () => dispatch(replyCompose(status, router)), + onConfirm: () => dispatch(replyCompose(status, router, rebloggedBy)), }, })); } else { - dispatch(replyCompose(status, router)); + dispatch(replyCompose(status, router, rebloggedBy)); } }); }, @@ -184,6 +189,7 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onDelete (status, history, withRedraft = false) { + const { intl } = ownProps; if (!deleteModal) { dispatch(deleteStatus(status.get('id'), history, withRedraft)); } else { @@ -199,6 +205,7 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onEdit (status, history) { + const { intl } = ownProps; dispatch((_, getState) => { let state = getState(); if (state.getIn(['compose', 'text']).trim().length !== 0) { @@ -256,6 +263,7 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({ }, onAddFilter (status) { + const { contextType } = ownProps; dispatch(initAddFilter(status, { contextType })); }, diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx index dab63c4ce6d753..376caf096e2a80 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx @@ -183,6 +183,14 @@ class LocalSettingsPage extends PureComponent { > + + + mention.get('id') === me).map(mention => `@${mention.get('acct')} `)).join(''); } @@ -415,7 +418,7 @@ export default function compose(state = initialState, action) { return state.withMutations(map => { map.set('id', null); map.set('in_reply_to', action.status.get('id')); - map.set('text', statusToTextMentions(state, action.status)); + map.set('text', statusToTextMentions(state, action.status, action.statusRebloggedBy)); map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy'))); map.update( 'advanced_options', diff --git a/app/javascript/flavours/glitch/reducers/local_settings.js b/app/javascript/flavours/glitch/reducers/local_settings.js index 712f115d0b502f..932b4e86e767d1 100644 --- a/app/javascript/flavours/glitch/reducers/local_settings.js +++ b/app/javascript/flavours/glitch/reducers/local_settings.js @@ -14,6 +14,7 @@ const initialState = ImmutableMap({ confirm_missing_media_description: false, confirm_boost_missing_media_description: false, confirm_before_clearing_draft: true, + mention_reblogger: false, prepend_cw_re: true, preselect_on_reply: true, inline_preview_cards: true,