Page MenuHomePhabricator

[lib] Handle logged in / logged out case in useGetIdentitySearchAuthMessage
ClosedPublic

Authored by will on Feb 29 2024, 9:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 30, 9:11 AM
Unknown Object (File)
Wed, Jun 26, 8:20 PM
Unknown Object (File)
Wed, Jun 26, 12:34 PM
Unknown Object (File)
Wed, Jun 26, 9:05 AM
Unknown Object (File)
Mon, Jun 24, 3:26 AM
Unknown Object (File)
Fri, Jun 14, 2:06 AM
Unknown Object (File)
Thu, Jun 13, 6:16 PM
Unknown Object (File)
Thu, Jun 13, 8:12 AM
Subscribers

Details

Summary

This replaces the getAuthMetadata conditional (which wasn't necessary) with whether or not we're logged in. If we're not logged in,
we should return early with a null as to avoid checking the contents of the auth metadata

Downstream this will result in the IdentitySearchAuthMessage always being set to null, causing the identity search context to not initialize.
As users are not logged in, there shouldn't be any need to use identity search context anyway.

We also add a console log if the AuthMetadata is incomplete to notify devs as this shouldn't happen if we're logged in

Test Plan

Tested on local. Successfully returned a null IdentitySearchAuthMessage value. When logged out, there is no error message. When logged in, getting incomplete auth metadata console log message

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will retitled this revision from [lib] Replaces the getAuthmetadata conditional with loggedIn conditional to [lib] Handle logged in / logged out case in useGetIdentitySearchAuthMessage.Feb 29 2024, 9:33 AM
will edited the summary of this revision. (Show Details)
will edited the summary of this revision. (Show Details)
will requested review of this revision.Feb 29 2024, 9:45 AM

can we improve the test plan a little? we should check that if the user isn't logged in we don't get an error

lib/utils/identity-search-utils.js
31 ↗(On Diff #37711)
will marked an inline comment as done.
will edited the test plan for this revision. (Show Details)

authMetadata to auth message in console log

can we improve the test plan a little? we should check that if the user isn't logged in we don't get an error

tested and updated test plan. Should be all set

This revision is now accepted and ready to land.Feb 29 2024, 1:51 PM

what is IdentitySearchAccessToken? do you mean IdentitySearchAuthMessage?

what is IdentitySearchAccessToken? do you mean IdentitySearchAuthMessage?

yep. my bad