Chats: clicking "message" launches a new chat
This commit is contained in:
parent
e12b74713a
commit
10257f324d
2 changed files with 4 additions and 1 deletions
|
@ -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…
Reference in a new issue