From 63cc7fd18e46a23c2502b0ecc2e7048dddf2e642 Mon Sep 17 00:00:00 2001 From: Wesley Aptekar-Cassels Date: Mon, 21 Jun 2021 15:51:10 -0700 Subject: [PATCH] notifications: Match on realm URL .origin, not .href. We had a steady stream of errors in Sentry caused by differences between the `known_urls` and `realm_uri`, where one of those had an extra `/` on the end (or some more surprising junk, such as a `/join/` link) [1]. Since we don't support running Zulip on a non-root path [2], we can simply compare the domain instead of the href. This is probably more of a band-aid than a real fix (we should figure out how the strange values get into `known_urls` and fix that), but we might as well just check the domain, since the path doesn't matter. Related: #4309. [1] https://github.com/zulip/zulip-mobile/issues/4309#issuecomment-865389364 [2] https://chat.zulip.org/#narrow/stream/3-backend/topic/support.20for.20running.20on.20non-webroot.20url.3F --- src/notification/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification/index.js b/src/notification/index.js index dd1872c5afa..54aec966c37 100644 --- a/src/notification/index.js +++ b/src/notification/index.js @@ -48,7 +48,7 @@ export const getAccountFromNotificationData = ( const urlMatches = []; identities.forEach((account, i) => { - if (account.realm.href === realmUrl.href) { + if (account.realm.origin === realmUrl.origin) { urlMatches.push(i); } });