Progress on chat

This commit is contained in:
mgabdev
2020-12-22 14:19:38 -05:00
parent 7a62adea3e
commit 4e1e29571b
4 changed files with 17 additions and 6 deletions

View File

@@ -430,22 +430,24 @@ export const hideChatConversation = (chatConversationId) => (dispatch, getState)
dispatch(hideChatConversationFetch(chatConversationId))
api(getState).post(`/api/v1/chat_conversation/${chatConversationId}/mark_chat_conversation_hidden`).then((response) => {
dispatch(approveChatConversationRequestSuccess(chatConversationId))
}).catch((error) => dispatch(approveChatConversationRequestFail(error)))
dispatch(hideChatConversationSuccess(chatConversationId))
}).catch((error) => dispatch(hideChatConversationFail(error)))
}
export const hideChatConversationFetch = (chatConversationId) => ({
type: CHAT_CONVERSATION_HIDE_SUCCESS,
type: CHAT_CONVERSATION_HIDE_FETCH,
chatConversationId,
})
export const hideChatConversationSuccess = (chatConversationId) => ({
type: CHAT_CONVERSATION_HIDE_SUCCESS,
chatConversationId,
showToast: true,
})
export const hideChatConversationFail = () => ({
type: CHAT_CONVERSATION_HIDE_FAIL,
showToast: true,
})
/**

View File

@@ -15,10 +15,13 @@ import {
CHAT_CONVERSATIONS_APPROVED_EXPAND_SUCCESS,
CHAT_CONVERSATIONS_REQUESTED_FETCH_SUCCESS,
CHAT_CONVERSATIONS_REQUESTED_EXPAND_SUCCESS,
CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS,
CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS,
CHAT_CONVERSATION_REQUEST_APPROVE_SUCCESS,
CHAT_CONVERSATION_MARK_READ_SUCCESS,
SET_CHAT_CONVERSATION_EXPIRATION_SUCCESS,
CHAT_CONVERSATION_APPROVED_SEARCH_FETCH_SUCCESS,
CHAT_CONVERSATION_HIDE_FETCH,
} from '../actions/chat_conversations'
const initialState = ImmutableMap()
@@ -51,13 +54,14 @@ export default function chat_conversations(state = initialState, action) {
case CHAT_CONVERSATIONS_APPROVED_EXPAND_SUCCESS:
case CHAT_CONVERSATIONS_REQUESTED_FETCH_SUCCESS:
case CHAT_CONVERSATIONS_REQUESTED_EXPAND_SUCCESS:
case CHAT_CONVERSATIONS_MUTED_FETCH_SUCCESS:
case CHAT_CONVERSATIONS_MUTED_EXPAND_SUCCESS:
case CHAT_CONVERSATION_APPROVED_SEARCH_FETCH_SUCCESS:
return importChatConversations(state, action.chatConversations)
case CHAT_MESSAGES_SEND_SUCCESS:
return setLastChatMessage(state, action.chatMessage)
case CHAT_MESSAGES_DELETE_REQUEST:
// : todo : set last conversation message to one prior to this one
return state
case CHAT_CONVERSATION_HIDE_FETCH:
return state.delete(action.chatConversationId)
case CHAT_MESSAGES_PURGE_REQUEST:
// : todo :
return state