fix onboarding for messaging (#16729)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+28
@@ -221,6 +221,34 @@ describe('useTriggerProviderReconnect', () => {
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should pass skipMessageChannelConfiguration option to OAuth providers', async () => {
|
||||
const { result } = renderHook(() => useTriggerProviderReconnect(), {
|
||||
wrapper: Wrapper,
|
||||
});
|
||||
|
||||
const options = {
|
||||
skipMessageChannelConfiguration: true,
|
||||
messageVisibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
};
|
||||
|
||||
await act(async () => {
|
||||
await result.current.triggerProviderReconnect(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
undefined,
|
||||
options,
|
||||
);
|
||||
});
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
{
|
||||
...options,
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('error handling', () => {
|
||||
|
||||
@@ -36,11 +36,13 @@ export const useTriggerApisOAuth = () => {
|
||||
messageVisibility,
|
||||
calendarVisibility,
|
||||
loginHint,
|
||||
skipMessageChannelConfiguration,
|
||||
}: {
|
||||
redirectLocation?: AppPath | string;
|
||||
messageVisibility?: MessageChannelVisibility;
|
||||
calendarVisibility?: CalendarChannelVisibility;
|
||||
loginHint?: string;
|
||||
skipMessageChannelConfiguration?: boolean;
|
||||
} = {},
|
||||
) => {
|
||||
const authServerUrl = REACT_APP_SERVER_BASE_URL;
|
||||
@@ -66,6 +68,10 @@ export const useTriggerApisOAuth = () => {
|
||||
|
||||
params += loginHint ? `&loginHint=${loginHint}` : '';
|
||||
|
||||
params += skipMessageChannelConfiguration
|
||||
? `&skipMessageChannelConfiguration=${skipMessageChannelConfiguration}`
|
||||
: '';
|
||||
|
||||
redirect(`${authServerUrl}/auth/${getProviderUrl(provider)}?${params}`);
|
||||
},
|
||||
[generateTransientToken, redirect],
|
||||
|
||||
Reference in New Issue
Block a user