fix: Update missing features in unattended / mentions view (#6009)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2022-12-03 04:37:38 +05:30
committed by GitHub
parent a08099bbcc
commit c8ec397c79
4 changed files with 47 additions and 13 deletions

View File

@@ -187,6 +187,10 @@ import {
hasPressedAltAndKKey, hasPressedAltAndKKey,
} from 'shared/helpers/KeyboardHelpers'; } from 'shared/helpers/KeyboardHelpers';
import { conversationListPageURL } from '../helper/URLHelper'; import { conversationListPageURL } from '../helper/URLHelper';
import {
isOnMentionsView,
isOnUnattendedView,
} from '../store/modules/conversations/helpers/actionHelpers';
export default { export default {
components: { components: {
@@ -649,10 +653,16 @@ export default {
params: { accountId, inbox_id: inboxId, label, teamId }, params: { accountId, inbox_id: inboxId, label, teamId },
name, name,
} = this.$route; } = this.$route;
let conversationType = '';
if (isOnMentionsView({ route: { name } })) {
conversationType = 'mention';
} else if (isOnUnattendedView({ route: { name } })) {
conversationType = 'unattended';
}
this.$router.push( this.$router.push(
conversationListPageURL({ conversationListPageURL({
accountId, accountId,
conversationType: name === 'conversation_mentions' ? 'mention' : '', conversationType: conversationType,
customViewId: this.foldersId, customViewId: this.foldersId,
inboxId, inboxId,
label, label,

View File

@@ -87,6 +87,10 @@ import {
} from 'dashboard/helper/inbox'; } from 'dashboard/helper/inbox';
import SecondaryChildNavItem from './SecondaryChildNavItem'; import SecondaryChildNavItem from './SecondaryChildNavItem';
import {
isOnMentionsView,
isOnUnattendedView,
} from '../../../store/modules/conversations/helpers/actionHelpers';
export default { export default {
components: { SecondaryChildNavItem }, components: { SecondaryChildNavItem },
@@ -115,19 +119,31 @@ export default {
this.menuItem.featureFlag this.menuItem.featureFlag
); );
}, },
isInboxConversation() { isAllConversations() {
return ( return (
this.$store.state.route.name === 'inbox_conversation' && this.$store.state.route.name === 'inbox_conversation' &&
this.menuItem.toStateName === 'home' this.menuItem.toStateName === 'home'
); );
}, },
isMentions() {
return (
isOnMentionsView({ route: this.$route }) &&
this.menuItem.toStateName === 'conversation_mentions'
);
},
isUnattended() {
return (
isOnUnattendedView({ route: this.$route }) &&
this.menuItem.toStateName === 'conversation_unattended'
);
},
isTeamsSettings() { isTeamsSettings() {
return ( return (
this.$store.state.route.name === 'settings_teams_edit' && this.$store.state.route.name === 'settings_teams_edit' &&
this.menuItem.toStateName === 'settings_teams_list' this.menuItem.toStateName === 'settings_teams_list'
); );
}, },
isInboxsSettings() { isInboxSettings() {
return ( return (
this.$store.state.route.name === 'settings_inbox_show' && this.$store.state.route.name === 'settings_inbox_show' &&
this.menuItem.toStateName === 'settings_inbox_list' this.menuItem.toStateName === 'settings_inbox_list'
@@ -150,14 +166,20 @@ export default {
}, },
computedClass() { computedClass() {
// If active Inbox is present // If active inbox is present, do not highlight conversations
// donot highlight conversations
if (this.activeInbox) return ' '; if (this.activeInbox) return ' ';
if (
this.isAllConversations ||
this.isMentions ||
this.isUnattended ||
this.isCurrentRoute
) {
return 'is-active';
}
if (this.hasSubMenu) { if (this.hasSubMenu) {
if ( if (
this.isInboxConversation ||
this.isTeamsSettings || this.isTeamsSettings ||
this.isInboxsSettings || this.isInboxSettings ||
this.isIntegrationsSettings || this.isIntegrationsSettings ||
this.isApplicationsSettings this.isApplicationsSettings
) { ) {
@@ -166,10 +188,6 @@ export default {
return ' '; return ' ';
} }
if (this.isCurrentRoute) {
return 'is-active';
}
return ''; return '';
}, },
}, },

View File

@@ -75,12 +75,16 @@ export const conversationListPageURL = ({
url = `accounts/${accountId}/label/${label}`; url = `accounts/${accountId}/label/${label}`;
} else if (teamId) { } else if (teamId) {
url = `accounts/${accountId}/team/${teamId}`; url = `accounts/${accountId}/team/${teamId}`;
} else if (conversationType === 'mention') {
url = `accounts/${accountId}/mentions/conversations`;
} else if (inboxId) { } else if (inboxId) {
url = `accounts/${accountId}/inbox/${inboxId}`; url = `accounts/${accountId}/inbox/${inboxId}`;
} else if (customViewId) { } else if (customViewId) {
url = `accounts/${accountId}/custom_view/${customViewId}`; url = `accounts/${accountId}/custom_view/${customViewId}`;
} else if (conversationType) {
const urlMap = {
mention: 'mentions/conversations',
unattended: 'unattended/conversations',
};
url = `accounts/${accountId}/${urlMap[conversationType]}`;
} }
return frontendURL(url); return frontendURL(url);
}; };

View File

@@ -99,6 +99,8 @@ const MUTE_ACTION = {
export const isAConversationRoute = routeName => export const isAConversationRoute = routeName =>
[ [
'inbox_conversation', 'inbox_conversation',
'conversation_through_mentions',
'conversation_through_unattended',
'conversation_through_inbox', 'conversation_through_inbox',
'conversations_through_label', 'conversations_through_label',
'conversations_through_team', 'conversations_through_team',