-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5899 display a banner to alert users which need to reconnect their account #6301
5899 display a banner to alert users which need to reconnect their account #6301
Conversation
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added
userVars
field toCurrentUser
type in/packages/twenty-front/src/modules/auth/states/currentUserState.ts
- Introduced
InformationBanner
component in/packages/twenty-front/src/modules/object-record/information-banner/InformationBanner.tsx
- Integrated
InformationBanner
into multiple settings pages, including/packages/twenty-front/src/pages/settings/SettingsAppearance.tsx
,/packages/twenty-front/src/pages/settings/SettingsBilling.tsx
, and others - Updated
USER_QUERY_FRAGMENT
to includeuserVars
in/packages/twenty-front/src/modules/users/graphql/fragments/userQueryFragment.ts
- Removed unused import in
/packages/twenty-front/src/modules/users/components/UserProviderEffect.tsx
29 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings
|
||
const userVars = currentUser?.userVars; | ||
|
||
const accountsToReconnect = userVars?.['ACCOUNTS_TO_RECONNECT'] ?? []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Consider adding a type check for userVars
to ensure it is an object.
|
||
return ( | ||
<Banner> | ||
Sync lost with mailbox {accountsToReconnect[0]}. Please reconnect for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic: Ensure accountsToReconnect[0]
is defined before accessing it to avoid potential runtime errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Updated
fieldMetadataItemSchema.ts
to acceptexistingLabels
for dynamic validation - Enhanced
metadataLabelSchema.ts
for label uniqueness and improved error messages - Modified
SettingsDataModelFieldAboutForm.tsx
for better error handling and validation - Added error handling in
TextInputV2.tsx
and updated styling for error states - Updated database commands in
0-22-upgrade-version.command.ts
for new address field and enum updates
27 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
…insufficient permissions
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
…eed-to-reconnect-their-account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, I've left a some comments!
packages/twenty-front/src/modules/object-record/information-banner/InformationBanner.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-record/information-banner/InformationBanner.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-record/information-banner/InformationBanner.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/object-record/information-banner/InformationBanner.tsx
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,136 @@ | |||
import { formatUserVars } from 'src/engine/core-modules/user/utils/format-user-vars.util'; | |||
|
|||
describe('formatUserVars', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice! Bravo!
packages/twenty-server/src/engine/core-modules/user/utils/format-user-vars.util.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/user/utils/format-user-vars.util.ts
Outdated
Show resolved
Hide resolved
|
||
accountsToReconnect.push(connectedAccountId); | ||
|
||
await this.keyValuePairService.set({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the userVar service!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we don't have to pass the 'type' (here you are relying on userVar to be the defaultValue which does not seem to be right!)
await this.addToAccountsToReconnect(messageChannelId, workspaceId); | ||
} | ||
|
||
private async addToAccountsToReconnect( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like to be duplicated logic. I would put it in a connectedAccount service (we need to double check the dependencies) that would take { workspaceId, connectedAccountId } as parameters
…eed-to-reconnect-their-account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I've push a few modifications:
- keep KeyValuePair service as simple and agnostic as possible
- enforce usage of userVarsService (no direct access to KeyValuePair service)
- add allowList on userVars resolver
- move userVars from user entity to a resolve field in user.resolver
- rework typings
|
||
const userVars = currentUser?.userVars; | ||
|
||
const accountIdToReconnect = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firstAccountIdToReconnect
Closes #5899