Actually fix post reply issue, #80

merge-requests/11/merge
Alex Gleason 2020-05-17 22:22:13 -05:00
rodzic 516e690da4
commit a2aac69838
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -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'));

Wyświetl plik

@ -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);