Bug : Inbox Filter indicator is removed when a conversation is selected (#535)
This commit is contained in:
committed by
GitHub
parent
bc884ae184
commit
330bf87f08
@@ -46,7 +46,7 @@ import getEmojiSVG from '../emoji/utils';
|
|||||||
import conversationMixin from '../../../mixins/conversations';
|
import conversationMixin from '../../../mixins/conversations';
|
||||||
import timeMixin from '../../../mixins/time';
|
import timeMixin from '../../../mixins/time';
|
||||||
import router from '../../../routes';
|
import router from '../../../routes';
|
||||||
import { frontendURL } from '../../../helper/URLHelper';
|
import { frontendURL, conversationUrl } from '../../../helper/URLHelper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -95,9 +95,9 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
cardClick(chat) {
|
cardClick(chat) {
|
||||||
router.push({
|
const { activeInbox } = this;
|
||||||
path: frontendURL(`conversations/${chat.id}`),
|
const path = conversationUrl(activeInbox, chat.id);
|
||||||
});
|
router.push({ path: frontendURL(path) });
|
||||||
},
|
},
|
||||||
extractMessageText(chatItem) {
|
extractMessageText(chatItem) {
|
||||||
if (chatItem.content) {
|
if (chatItem.content) {
|
||||||
|
|||||||
@@ -4,3 +4,10 @@ export const frontendURL = (path, params) => {
|
|||||||
const stringifiedParams = params ? `?${queryString.stringify(params)}` : '';
|
const stringifiedParams = params ? `?${queryString.stringify(params)}` : '';
|
||||||
return `/app/${path}${stringifiedParams}`;
|
return `/app/${path}${stringifiedParams}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const conversationUrl = (activeInbox, id) => {
|
||||||
|
const path = activeInbox
|
||||||
|
? `inbox/${activeInbox}/conversations/${id}`
|
||||||
|
: `conversations/${id}`;
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
|||||||
21
app/javascript/dashboard/helper/spec/URLHelper.spec.js
Normal file
21
app/javascript/dashboard/helper/spec/URLHelper.spec.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { frontendURL, conversationUrl } from '../URLHelper';
|
||||||
|
|
||||||
|
describe('#URL Helpers', () => {
|
||||||
|
describe('conversationUrl', () => {
|
||||||
|
it('should return direct conversation URL if activeInbox is nil', () => {
|
||||||
|
expect(conversationUrl(undefined, 1)).toBe('conversations/1');
|
||||||
|
});
|
||||||
|
it('should return ibox conversation URL if activeInbox is not nil', () => {
|
||||||
|
expect(conversationUrl(2, 1)).toBe('inbox/2/conversations/1');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('frontendURL', () => {
|
||||||
|
it('should return url without params if params passed is nil', () => {
|
||||||
|
expect(frontendURL('main', null)).toBe('/app/main');
|
||||||
|
});
|
||||||
|
it('should return url without params if params passed is not nil', () => {
|
||||||
|
expect(frontendURL('main', { ping: 'pong' })).toBe('/app/main?ping=pong');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -6,6 +6,7 @@ export default {
|
|||||||
'home',
|
'home',
|
||||||
'inbox_dashboard',
|
'inbox_dashboard',
|
||||||
'inbox_conversation',
|
'inbox_conversation',
|
||||||
|
'conversation_through_inbox',
|
||||||
'settings_account_reports',
|
'settings_account_reports',
|
||||||
'billing_deactivated',
|
'billing_deactivated',
|
||||||
'profile_settings',
|
'profile_settings',
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ export default {
|
|||||||
this.$store.dispatch('setActiveInbox', this.inboxId);
|
this.$store.dispatch('setActiveInbox', this.inboxId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'conversation_through_inbox':
|
||||||
|
if (this.inboxId) {
|
||||||
|
this.$store.dispatch('setActiveInbox', this.inboxId);
|
||||||
|
}
|
||||||
|
this.setActiveChat();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.$store.dispatch('setActiveInbox', null);
|
this.$store.dispatch('setActiveInbox', null);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -31,5 +31,17 @@ export default {
|
|||||||
return { conversationId: route.params.conversation_id };
|
return { conversationId: route.params.conversation_id };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: frontendURL('inbox/:inbox_id/conversations/:conversation_id'),
|
||||||
|
name: 'conversation_through_inbox',
|
||||||
|
roles: ['administrator', 'agent'],
|
||||||
|
component: ConversationView,
|
||||||
|
props: route => {
|
||||||
|
return {
|
||||||
|
conversationId: route.params.conversation_id,
|
||||||
|
inboxId: route.params.inbox_id,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user