From 10257f324de0cc6a8e473ddc0c2812f3b60559d3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 27 Aug 2020 13:01:06 -0500 Subject: [PATCH] Chats: clicking "message" launches a new chat --- app/soapbox/actions/chats.js | 1 + app/soapbox/reducers/chats.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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; }