@@ -5,13 +5,22 @@ export const frontendURL = (path, params) => {
|
||||
return `/app/${path}${stringifiedParams}`;
|
||||
};
|
||||
|
||||
export const conversationUrl = ({ accountId, activeInbox, id, label }) => {
|
||||
export const conversationUrl = ({
|
||||
accountId,
|
||||
activeInbox,
|
||||
id,
|
||||
label,
|
||||
teamId,
|
||||
}) => {
|
||||
if (activeInbox) {
|
||||
return `accounts/${accountId}/inbox/${activeInbox}/conversations/${id}`;
|
||||
}
|
||||
if (label) {
|
||||
return `accounts/${accountId}/label/${label}/conversations/${id}`;
|
||||
}
|
||||
if (teamId) {
|
||||
return `accounts/${accountId}/team/${teamId}/conversations/${id}`;
|
||||
}
|
||||
return `accounts/${accountId}/conversations/${id}`;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ describe('#URL Helpers', () => {
|
||||
conversationUrl({ accountId: 1, label: 'customer-support', id: 1 })
|
||||
).toBe('accounts/1/label/customer-support/conversations/1');
|
||||
});
|
||||
it('should return correct conversation URL if team Id is available', () => {
|
||||
expect(conversationUrl({ accountId: 1, teamId: 1, id: 1 })).toBe(
|
||||
'accounts/1/team/1/conversations/1'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('frontendURL', () => {
|
||||
|
||||
Reference in New Issue
Block a user