## Summary This PR enables the **Participating** conversation view in the main sidebar and keeps the behavior aligned with existing conversation views. ## What changed - Added **Participating** under Conversations in the new sidebar. - Added a guard in conversation realtime `addConversation` flow so generic `conversation.created` events are not injected while the user is on Participating view. - Added participating route mapping in conversation-list redirect helper so list redirects resolve correctly to `/participating/conversations`. ## Scope notes - Kept changes minimal and consistent with current `develop` behavior. - No additional update-event filtering was added beyond what existing views already do. --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com>
71 lines
2.0 KiB
JavaScript
71 lines
2.0 KiB
JavaScript
import types from '../../../mutation-types';
|
|
|
|
export const setPageFilter = ({ dispatch, filter, page, markEndReached }) => {
|
|
dispatch('conversationPage/setCurrentPage', { filter, page }, { root: true });
|
|
if (markEndReached) {
|
|
dispatch('conversationPage/setEndReached', { filter }, { root: true });
|
|
}
|
|
};
|
|
|
|
export const setContacts = (commit, chatList) => {
|
|
commit(
|
|
`contacts/${types.SET_CONTACTS}`,
|
|
chatList.map(chat => chat.meta.sender)
|
|
);
|
|
};
|
|
|
|
export const isOnMentionsView = ({ route: { name: routeName } }) => {
|
|
const MENTION_ROUTES = [
|
|
'conversation_mentions',
|
|
'conversation_through_mentions',
|
|
];
|
|
return MENTION_ROUTES.includes(routeName);
|
|
};
|
|
|
|
export const isOnUnattendedView = ({ route: { name: routeName } }) => {
|
|
const UNATTENDED_ROUTES = [
|
|
'conversation_unattended',
|
|
'conversation_through_unattended',
|
|
];
|
|
return UNATTENDED_ROUTES.includes(routeName);
|
|
};
|
|
|
|
export const isOnParticipatingView = ({ route: { name: routeName } }) => {
|
|
const PARTICIPATING_ROUTES = [
|
|
'conversation_participating',
|
|
'conversation_through_participating',
|
|
];
|
|
return PARTICIPATING_ROUTES.includes(routeName);
|
|
};
|
|
|
|
export const isOnFoldersView = ({ route: { name: routeName } }) => {
|
|
const FOLDER_ROUTES = [
|
|
'folder_conversations',
|
|
'conversations_through_folders',
|
|
];
|
|
return FOLDER_ROUTES.includes(routeName);
|
|
};
|
|
|
|
export const buildConversationList = (
|
|
context,
|
|
requestPayload,
|
|
responseData,
|
|
filterType
|
|
) => {
|
|
const { payload: conversationList, meta: metaData } = responseData;
|
|
context.commit(types.SET_ALL_CONVERSATION, conversationList);
|
|
context.dispatch('conversationStats/set', metaData);
|
|
context.dispatch(
|
|
'conversationLabels/setBulkConversationLabels',
|
|
conversationList
|
|
);
|
|
context.commit(types.CLEAR_LIST_LOADING_STATUS);
|
|
setContacts(context.commit, conversationList);
|
|
setPageFilter({
|
|
dispatch: context.dispatch,
|
|
filter: filterType,
|
|
page: requestPayload.page,
|
|
markEndReached: !conversationList.length,
|
|
});
|
|
};
|