Chats: clicking "message" launches a new chat

merge-requests/214/head
Alex Gleason 4 years ago
parent e12b74713a
commit 10257f324d
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -108,6 +108,7 @@ export function startChat(accountId) {
dispatch({ type: CHAT_FETCH_REQUEST, accountId });
return api(getState).post(`/api/v1/pleroma/chats/by-account-id/${accountId}`).then(({ data }) => {
dispatch({ type: CHAT_FETCH_SUCCESS, chat: data });
dispatch(openChat(data.id));
}).catch(error => {
dispatch({ type: CHAT_FETCH_FAIL, accountId, error });
});

@ -1,4 +1,4 @@
import { CHATS_FETCH_SUCCESS } from 'soapbox/actions/chats';
import { CHATS_FETCH_SUCCESS, CHAT_FETCH_SUCCESS } from 'soapbox/actions/chats';
import { STREAMING_CHAT_UPDATE } from 'soapbox/actions/streaming';
import { normalizeChat } from 'soapbox/actions/importer/normalizer';
import { Map as ImmutableMap, fromJS } from 'immutable';
@ -16,6 +16,8 @@ export default function chats(state = initialState, action) {
return importChats(state, action.chats);
case STREAMING_CHAT_UPDATE:
return importChats(state, [action.chat]);
case CHAT_FETCH_SUCCESS:
return importChats(state, [action.chat]);
default:
return state;
}

Loading…
Cancel
Save