diff --git a/app/soapbox/actions/chats.js b/app/soapbox/actions/chats.js index 1934ba13e..1adc41e1e 100644 --- a/app/soapbox/actions/chats.js +++ b/app/soapbox/actions/chats.js @@ -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 }); }); diff --git a/app/soapbox/reducers/chats.js b/app/soapbox/reducers/chats.js index aee2ee999..7659e38e7 100644 --- a/app/soapbox/reducers/chats.js +++ b/app/soapbox/reducers/chats.js @@ -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; }