mirror of https://github.com/buster-so/buster.git
Update SlackHandler redirects to include '/app' in integration URLs
This commit is contained in:
parent
6d0d119364
commit
75e011ac65
|
@ -287,7 +287,7 @@ describe.skipIf(skipIfNoEnv)('SlackHandler Integration Tests', () => {
|
|||
});
|
||||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get('Location')).toBe('/settings/integrations?status=cancelled');
|
||||
expect(response.headers.get('Location')).toBe('/app/settings/integrations?status=cancelled');
|
||||
});
|
||||
|
||||
it('should redirect on invalid parameters', async () => {
|
||||
|
@ -297,7 +297,7 @@ describe.skipIf(skipIfNoEnv)('SlackHandler Integration Tests', () => {
|
|||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get('Location')).toBe(
|
||||
'/settings/integrations?status=error&error=invalid_parameters'
|
||||
'/app/settings/integrations?status=error&error=invalid_parameters'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -355,7 +355,7 @@ describe.skipIf(skipIfNoEnv)('SlackHandler Integration Tests', () => {
|
|||
|
||||
expect(response.status).toBe(302);
|
||||
expect(response.headers.get('Location')).toBe(
|
||||
'/settings/integrations?status=error&error=Invalid%20or%20expired%20OAuth%20state'
|
||||
'/app/settings/integrations?status=error&error=Invalid%20or%20expired%20OAuth%20state'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -132,7 +132,9 @@ describe('SlackHandler', () => {
|
|||
|
||||
await handler.handleOAuthCallback(mockContext);
|
||||
|
||||
expect(mockContext.redirect).toHaveBeenCalledWith('/settings/integrations?status=cancelled');
|
||||
expect(mockContext.redirect).toHaveBeenCalledWith(
|
||||
'/app/settings/integrations?status=cancelled'
|
||||
);
|
||||
});
|
||||
|
||||
it('should redirect on invalid parameters', async () => {
|
||||
|
@ -141,7 +143,7 @@ describe('SlackHandler', () => {
|
|||
await handler.handleOAuthCallback(mockContext);
|
||||
|
||||
expect(mockContext.redirect).toHaveBeenCalledWith(
|
||||
'/settings/integrations?status=error&error=invalid_parameters'
|
||||
'/app/settings/integrations?status=error&error=invalid_parameters'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -186,7 +188,7 @@ describe('SlackHandler', () => {
|
|||
await handler.handleOAuthCallback(mockContext);
|
||||
|
||||
expect(mockContext.redirect).toHaveBeenCalledWith(
|
||||
'/settings/integrations?status=error&error=invalid_state'
|
||||
'/app/settings/integrations?status=error&error=invalid_state'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -136,7 +136,7 @@ export class SlackHandler {
|
|||
|
||||
// Check if service is available
|
||||
if (!slackOAuthService) {
|
||||
return c.redirect('/settings/integrations?status=error&error=not_configured');
|
||||
return c.redirect('/app/settings/integrations?status=error&error=not_configured');
|
||||
}
|
||||
|
||||
// Parse query parameters
|
||||
|
@ -153,7 +153,7 @@ export class SlackHandler {
|
|||
// Handle user denial
|
||||
if (query.error === 'access_denied') {
|
||||
console.info('OAuth flow cancelled by user');
|
||||
return c.redirect('/settings/integrations?status=cancelled');
|
||||
return c.redirect('/app/settings/integrations?status=cancelled');
|
||||
}
|
||||
|
||||
console.error('Invalid OAuth callback parameters:', {
|
||||
|
@ -161,7 +161,7 @@ export class SlackHandler {
|
|||
providedKeys: Object.keys(query),
|
||||
expectedKeys: ['code', 'state'],
|
||||
});
|
||||
return c.redirect('/settings/integrations?status=error&error=invalid_parameters');
|
||||
return c.redirect('/app/settings/integrations?status=error&error=invalid_parameters');
|
||||
}
|
||||
|
||||
// Handle OAuth callback
|
||||
|
@ -178,11 +178,11 @@ export class SlackHandler {
|
|||
resultKeys: Object.keys(result),
|
||||
});
|
||||
const errorParam = encodeURIComponent(result.error || 'unknown_error');
|
||||
return c.redirect(`/settings/integrations?status=error&error=${errorParam}`);
|
||||
return c.redirect(`/app/settings/integrations?status=error&error=${errorParam}`);
|
||||
}
|
||||
|
||||
// Use metadata to determine return URL
|
||||
const returnUrl = result.metadata?.returnUrl || '/settings/integrations';
|
||||
const returnUrl = result.metadata?.returnUrl || '/app/settings/integrations';
|
||||
const workspaceParam = result.teamName
|
||||
? `&workspace=${encodeURIComponent(result.teamName)}`
|
||||
: '';
|
||||
|
@ -197,7 +197,7 @@ export class SlackHandler {
|
|||
});
|
||||
const errorMessage = error instanceof Error ? error.message : 'callback_failed';
|
||||
return c.redirect(
|
||||
`/settings/integrations?status=error&error=${encodeURIComponent(errorMessage)}`
|
||||
`/app/settings/integrations?status=error&error=${encodeURIComponent(errorMessage)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue