Actually fix post reply issue, #80
This commit is contained in:
parent
516e690da4
commit
a2aac69838
|
@ -82,9 +82,11 @@ export function changeCompose(text) {
|
||||||
|
|
||||||
export function replyCompose(status, routerHistory) {
|
export function replyCompose(status, routerHistory) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
const state = getState();
|
||||||
dispatch({
|
dispatch({
|
||||||
type: COMPOSE_REPLY,
|
type: COMPOSE_REPLY,
|
||||||
status: status,
|
status: status,
|
||||||
|
account: state.getIn(['accounts', state.get('me')]),
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(openModal('COMPOSE'));
|
dispatch(openModal('COMPOSE'));
|
||||||
|
|
|
@ -78,14 +78,13 @@ const initialPoll = ImmutableMap({
|
||||||
multiple: false,
|
multiple: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function statusToTextMentions(state, status) {
|
function statusToTextMentions(state, status, account) {
|
||||||
const me = state.getIn(['accounts', state.get('me'), 'acct']);
|
const author = status.getIn(['account', 'acct']);
|
||||||
const author = state.getIn(['accounts', status.get('account'), 'acct']);
|
|
||||||
const mentions = status.get('mentions', []).map(m => m.get('acct'));
|
const mentions = status.get('mentions', []).map(m => m.get('acct'));
|
||||||
|
|
||||||
return ImmutableOrderedSet([author])
|
return ImmutableOrderedSet([author])
|
||||||
.concat(mentions)
|
.concat(mentions)
|
||||||
.delete(me)
|
.delete(account.get('acct'))
|
||||||
.map(m => `@${m} `)
|
.map(m => `@${m} `)
|
||||||
.join('');
|
.join('');
|
||||||
};
|
};
|
||||||
|
@ -245,7 +244,7 @@ export default function compose(state = initialState, action) {
|
||||||
case COMPOSE_REPLY:
|
case COMPOSE_REPLY:
|
||||||
return state.withMutations(map => {
|
return state.withMutations(map => {
|
||||||
map.set('in_reply_to', action.status.get('id'));
|
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('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
|
||||||
map.set('focusDate', new Date());
|
map.set('focusDate', new Date());
|
||||||
map.set('caretPosition', null);
|
map.set('caretPosition', null);
|
||||||
|
|
Loading…
Reference in New Issue