Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnski committed Dec 20, 2021
1 parent 96d48ff commit 9591d3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mysky/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ export class MySky {
}

// Call the `onUserLogin` hook for all DACs.
await Promise.all(
await Promise.allSettled(
this.dacs.map(async (dac) => {
try {
await dac.onUserLogin();
Expand Down
9 changes: 4 additions & 5 deletions src/mysky/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export async function getFullDomainUrl(this: SkynetClient, domain: string): Prom
return getFullDomainUrlForPortal(portalUrl, domain);
}

// TODO: unit test
/**
* Gets the URL for the current skapp on the preferred portal, if we're not on
* the preferred portal already.
Expand Down Expand Up @@ -97,8 +96,8 @@ export function popupCenter(url: string, winName: string, w: number, h: number):
* @returns - Whether the two URLs are equal for the purposes of redirecting.
*/
export function shouldRedirectToPreferredPortalUrl(currentPortalUrl: string, preferredPortalUrl: string): boolean {
currentPortalUrl = currentPortalUrl.split("//", 2)[1] || currentPortalUrl;
preferredPortalUrl = preferredPortalUrl.split("//", 2)[1] || preferredPortalUrl;

return trimSuffix(currentPortalUrl, "/") === trimSuffix(preferredPortalUrl, "/");
// Strip protocol and trailing slash (case-insensitive).
currentPortalUrl = trimSuffix(currentPortalUrl.replace(/https:\/\/|http:\/\//i, ""), "/");
preferredPortalUrl = trimSuffix(preferredPortalUrl.replace(/https:\/\/|http:\/\//i, ""), "/");
return currentPortalUrl === preferredPortalUrl;
}

0 comments on commit 9591d3b

Please sign in to comment.