Skip to content

Commit 4dca971

Browse files
gnpricechrisbobbe
authored andcommitted
account [nfc]: Lower a getAccountStatuses call site to getIdentities
1 parent ca683b5 commit 4dca971

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/sentry.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { nativeApplicationVersion } from 'expo-application';
55
// $FlowFixMe[untyped-import]
66
import md5 from 'blueimp-md5';
77

8-
import type { AccountStatus } from './account/accountsSelectors';
8+
import type { Identity } from './types';
99
import isAppOwnDomain from './isAppOwnDomain';
1010
import store from './boot/store';
11-
import { getAccountStatuses } from './account/accountsSelectors';
11+
import { getIdentities } from './account/accountsSelectors';
1212
import { sentryKey } from './sentryConfig';
1313
import { isUrlOnRealm } from './utils/url';
1414

@@ -70,7 +70,7 @@ type HttpBreadcrumb = $ReadOnly<{|
7070
|},
7171
|}>;
7272

73-
function shouldScrubHost(url: URL, accountStatuses: $ReadOnlyArray<AccountStatus>) {
73+
function shouldScrubHost(url: URL, identities: $ReadOnlyArray<Identity>) {
7474
if (isAppOwnDomain(url)) {
7575
return false;
7676
}
@@ -82,7 +82,7 @@ function shouldScrubHost(url: URL, accountStatuses: $ReadOnlyArray<AccountStatus
8282
return true;
8383
}
8484

85-
if (accountStatuses.some(({ realm }) => isUrlOnRealm(url, realm))) {
85+
if (identities.some(({ realm }) => isUrlOnRealm(url, realm))) {
8686
// Definitely a request to a Zulip realm. Will catch requests to realms
8787
// in the account-statuses state, including those without `/api/v1`,
8888
// like `/avatar/{user_id}` (zulip/zulip@0f9970fd3 confirms that this
@@ -99,8 +99,8 @@ function scrubUrl(unscrubbedUrl: void | string): void | string {
9999
}
100100

101101
const parsedUrl = new URL(unscrubbedUrl);
102-
const accountStatuses = getAccountStatuses(store.getState());
103-
if (!shouldScrubHost(parsedUrl, accountStatuses)) {
102+
const identities = getIdentities(store.getState());
103+
if (!shouldScrubHost(parsedUrl, identities)) {
104104
return unscrubbedUrl;
105105
}
106106

0 commit comments

Comments
 (0)