feat: Improve email rendering, introduce a new layout for emails (#5039)
Co-authored-by: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,26 @@ export const conversationUrl = ({
|
||||
return url;
|
||||
};
|
||||
|
||||
export const conversationListPageURL = ({
|
||||
accountId,
|
||||
conversationType = '',
|
||||
inboxId,
|
||||
label,
|
||||
teamId,
|
||||
}) => {
|
||||
let url = `accounts/${accountId}/dashboard`;
|
||||
if (label) {
|
||||
url = `accounts/${accountId}/label/${label}`;
|
||||
} else if (teamId) {
|
||||
url = `accounts/${accountId}/team/${teamId}`;
|
||||
} else if (conversationType === 'mention') {
|
||||
url = `accounts/${accountId}/mentions/conversations`;
|
||||
} else if (inboxId) {
|
||||
url = `accounts/${accountId}/inbox/${inboxId}`;
|
||||
}
|
||||
return frontendURL(url);
|
||||
};
|
||||
|
||||
export const isValidURL = value => {
|
||||
/* eslint-disable no-useless-escape */
|
||||
const URL_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm;
|
||||
|
||||
@@ -3,9 +3,33 @@ import {
|
||||
conversationUrl,
|
||||
isValidURL,
|
||||
getLoginRedirectURL,
|
||||
conversationListPageURL,
|
||||
} from '../URLHelper';
|
||||
|
||||
describe('#URL Helpers', () => {
|
||||
describe('conversationListPageURL', () => {
|
||||
it('should return url to dashboard', () => {
|
||||
expect(conversationListPageURL({ accountId: 1 })).toBe(
|
||||
'/app/accounts/1/dashboard'
|
||||
);
|
||||
});
|
||||
it('should return url to inbox', () => {
|
||||
expect(conversationListPageURL({ accountId: 1, inboxId: 1 })).toBe(
|
||||
'/app/accounts/1/inbox/1'
|
||||
);
|
||||
});
|
||||
it('should return url to label', () => {
|
||||
expect(conversationListPageURL({ accountId: 1, label: 'support' })).toBe(
|
||||
'/app/accounts/1/label/support'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return url to team', () => {
|
||||
expect(conversationListPageURL({ accountId: 1, teamId: 1 })).toBe(
|
||||
'/app/accounts/1/team/1'
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('conversationUrl', () => {
|
||||
it('should return direct conversation URL if activeInbox is nil', () => {
|
||||
expect(conversationUrl({ accountId: 1, id: 1 })).toBe(
|
||||
|
||||
Reference in New Issue
Block a user