SDA-2977: UBS: Inconsistent 'Copy Email Address' output on MessageML (#1193)

* fix: SDA-2948 (Redesign notification) (#1186)

* fix: SDA-2948 - Redesign notification

* fix: SDA-2948 - Fix background color

* SDA-2977: add support for mailto links

Co-authored-by: Kiran Niranjan <kiran.niranjan@symphony.com>
This commit is contained in:
Vishwas Shashidhar 2021-03-01 16:43:33 +05:30 committed by GitHub
parent 426964ccaf
commit 57c363f956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 20 deletions

View File

@ -36,25 +36,18 @@ const MIN_HEIGHT = 300;
*/ */
const verifyProtocolForNewUrl = (url: string): boolean => { const verifyProtocolForNewUrl = (url: string): boolean => {
const parsedUrl = parse(url); const parsedUrl = parse(url);
if (!parsedUrl) { if (!parsedUrl || !parsedUrl.protocol) {
logger.info( logger.info(
`child-window-handler: The url ${url} doesn't have a protocol. Returning false for verification!`, `child-window-handler: The url ${url} doesn't have a protocol. Returning false for verification!`,
); );
return false; return false;
} }
const allowedProtocols = ['http:', 'https:', 'mailto:'];
// url parse returns protocol with : // url parse returns protocol with :
if (parsedUrl.protocol === 'https:') { if (allowedProtocols.includes(parsedUrl.protocol)) {
logger.info( logger.info(
`child-window-handler: The url ${url} is a https url! Returning true for verification!`, `child-window-handler: Protocol of the url ${url} is whitelisted! Returning true for verification!`,
);
return true;
}
// url parse returns protocol with :
if (parsedUrl.protocol === 'http:') {
logger.info(
`child-window-handler: The url ${url} is a http url! Returning true for verification!`,
); );
return true; return true;
} }
@ -303,7 +296,7 @@ export const handleChildWindow = (webContents: WebContents): void => {
return; return;
} }
logger.info(`child-window-handler: new window url is ${newWinUrl} which is not of the same host, logger.info(`child-window-handler: new window url is ${newWinUrl} which is not of the same host,
so opening it in the default browser!`); so opening it in the default app!`);
windowHandler.openUrlInDefaultBrowser(newWinUrl); windowHandler.openUrlInDefaultBrowser(newWinUrl);
} }
}; };

View File

@ -434,6 +434,7 @@ class Notification extends NotificationHandler {
...this.activeNotifications, ...this.activeNotifications,
}; };
const inactiveNotificationWindows = { ...[], ...this.inactiveWindows }; const inactiveNotificationWindows = { ...[], ...this.inactiveWindows };
if (activeNotificationWindows && Array.isArray(activeNotificationWindows)) {
for (const activeWindow of activeNotificationWindows) { for (const activeWindow of activeNotificationWindows) {
if (activeWindow && windowExists(activeWindow)) { if (activeWindow && windowExists(activeWindow)) {
await this.hideNotification( await this.hideNotification(
@ -441,11 +442,18 @@ class Notification extends NotificationHandler {
); );
} }
} }
}
if (
inactiveNotificationWindows &&
Array.isArray(inactiveNotificationWindows)
) {
for (const inactiveWindow of inactiveNotificationWindows) { for (const inactiveWindow of inactiveNotificationWindows) {
if (inactiveWindow && windowExists(inactiveWindow)) { if (inactiveWindow && windowExists(inactiveWindow)) {
inactiveWindow.close(); inactiveWindow.close();
} }
} }
}
this.activeNotifications = []; this.activeNotifications = [];
this.inactiveWindows = []; this.inactiveWindows = [];