Feature: Move to the next conversation when I resolve a the current c… (#757)

* Feature: Move to the next conversation when I resolve a the current conversation

* check if nextId is present before emitting the event

* use es6 string literals

* use a named variable for better reading

* create a variable for better readability

* better sintax to get clickable element

* after last, go to first chat when resolve

* use state and action to set next chat

* remove not used emit

* clear selected state when there is not next chat

* Remove deprecated scope from FB Channel (#761)

Remove deprecated scope from FB Channel

* Feature: Customise the position of messenger (#767)

Co-authored-by: Nithin David Thomas <webofnithin@gmail.com>

* Bug: Redirect user to set new password screen (#772)

* auto linter

* fix js linter

* sort chats on getter / filter before getting next chat

* Revert not related changes on ConversationCard.vue

* add test for getNextChatConversation getter

* remove not used module

* add test for getAllConversations getter
This commit is contained in:
Bruno Almeida
2020-05-14 10:13:02 +02:00
committed by GitHub
parent e6bf81caf4
commit 1108446974
4 changed files with 106 additions and 7 deletions

View File

@@ -120,13 +120,19 @@ const actions = {
}
},
toggleStatus: async ({ commit }, data) => {
toggleStatus: async ({ commit, dispatch, getters }, data) => {
try {
const nextChat = getters.getNextChatConversation;
const response = await ConversationApi.toggleStatus(data);
commit(
types.default.RESOLVE_CONVERSATION,
response.data.payload.current_status
);
if (nextChat) {
dispatch('setActiveChat', nextChat);
} else {
dispatch('clearSelectedState');
}
} catch (error) {
// Handle error
}