Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3492746
D12356.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12356.diff
View Options
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -195,6 +195,9 @@
+linkFarcasterAccount: (farcasterID: string) => Promise<void>;
+unlinkFarcasterAccount: () => Promise<void>;
+findUserIdentities: (userIDs: $ReadOnlyArray<string>) => Promise<Identities>;
+ // We are introducing this on web temporarily to make sure the identity
+ // service is reachable in production
+ +ping?: () => Promise<void>;
}
export type IdentityServiceAuthLayer = {
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -51,6 +51,7 @@
import { MemberListSidebarProvider } from './chat/member-list-sidebar/member-list-sidebar-provider.react.js';
import CommunitiesRefresher from './components/communities-refresher.react.js';
import { DBOpsHandler } from './components/db-ops-handler.react.js';
+import IdentityPing from './components/identity-ping.react.js';
import LogOutIfMissingCSATHandler from './components/log-out-if-missing-csat-handler.react.js';
import NavigationArrows from './components/navigation-arrows.react.js';
import MinVersionHandler from './components/version-handler.react.js';
@@ -238,6 +239,7 @@
<InviteLinksRefresher />
<CommunitiesRefresher />
<MinVersionHandler />
+ <IdentityPing />
<PlatformDetailsSynchronizer />
<LogOutIfMissingCSATHandler />
<UserInfosHandler />
diff --git a/web/components/identity-ping.react.js b/web/components/identity-ping.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/identity-ping.react.js
@@ -0,0 +1,40 @@
+// @flow
+
+import * as React from 'react';
+
+import { IdentityClientContext } from 'lib/shared/identity-client-context.js';
+import { useIsCurrentUserStaff } from 'lib/shared/staff-utils.js';
+
+function IdentityPing(): React.Node {
+ const identityContext = React.useContext(IdentityClientContext);
+ const isCurrentUserStaff = useIsCurrentUserStaff();
+
+ const ping = React.useCallback(async () => {
+ try {
+ if (!identityContext) {
+ console.log('Identity context not available');
+ return;
+ }
+ const identityClient = identityContext.identityClient;
+ const pingCall = identityClient.ping;
+ if (!pingCall) {
+ console.log('Ping method unimplemented');
+ return;
+ }
+ await pingCall();
+ if (isCurrentUserStaff) {
+ console.log('Identity ping successful');
+ }
+ } catch (error) {
+ console.log('Error pinging identity service:', error);
+ }
+ }, [identityContext, isCurrentUserStaff]);
+
+ React.useEffect(() => {
+ void ping();
+ }, [ping]);
+
+ return null;
+}
+
+export default IdentityPing;
diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js
--- a/web/grpc/identity-service-client-wrapper.js
+++ b/web/grpc/identity-service-client-wrapper.js
@@ -667,6 +667,11 @@
return assertWithValidator(identities, identitiesValidator);
};
+
+ ping: () => Promise<void> = async () => {
+ const client = this.unauthClient;
+ await client.ping(new Empty());
+ };
}
function authNewDeviceKeyUpload(
diff --git a/web/grpc/identity-service-context-provider.react.js b/web/grpc/identity-service-context-provider.react.js
--- a/web/grpc/identity-service-context-provider.react.js
+++ b/web/grpc/identity-service-context-provider.react.js
@@ -139,6 +139,7 @@
linkFarcasterAccount: proxyMethodToWorker('linkFarcasterAccount'),
unlinkFarcasterAccount: proxyMethodToWorker('unlinkFarcasterAccount'),
findUserIdentities: proxyMethodToWorker('findUserIdentities'),
+ ping: proxyMethodToWorker('ping'),
};
}, [proxyMethodToWorker]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 1:17 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2679461
Default Alt Text
D12356.diff (3 KB)
Attached To
Mode
D12356: [web] introduce component to ping identity
Attached
Detach File
Event Timeline
Log In to Comment