diff --git a/app/gabsocial/actions/compose.js b/app/gabsocial/actions/compose.js index 5a9de9051..8219f6eae 100644 --- a/app/gabsocial/actions/compose.js +++ b/app/gabsocial/actions/compose.js @@ -82,9 +82,11 @@ export function changeCompose(text) { export function replyCompose(status, routerHistory) { return (dispatch, getState) => { + const state = getState(); dispatch({ type: COMPOSE_REPLY, status: status, + account: state.getIn(['accounts', state.get('me')]), }); dispatch(openModal('COMPOSE')); diff --git a/app/gabsocial/reducers/compose.js b/app/gabsocial/reducers/compose.js index 61a708211..844eb64dd 100644 --- a/app/gabsocial/reducers/compose.js +++ b/app/gabsocial/reducers/compose.js @@ -78,14 +78,13 @@ const initialPoll = ImmutableMap({ multiple: false, }); -function statusToTextMentions(state, status) { - const me = state.getIn(['accounts', state.get('me'), 'acct']); - const author = state.getIn(['accounts', status.get('account'), 'acct']); +function statusToTextMentions(state, status, account) { + const author = status.getIn(['account', 'acct']); const mentions = status.get('mentions', []).map(m => m.get('acct')); return ImmutableOrderedSet([author]) .concat(mentions) - .delete(me) + .delete(account.get('acct')) .map(m => `@${m} `) .join(''); }; @@ -245,7 +244,7 @@ export default function compose(state = initialState, action) { case COMPOSE_REPLY: return state.withMutations(map => { map.set('in_reply_to', action.status.get('id')); - map.set('text', statusToTextMentions(state, action.status)); + map.set('text', statusToTextMentions(state, action.status, action.account)); map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy'))); map.set('focusDate', new Date()); map.set('caretPosition', null);