Skip to content

Conversation

@JammingBen
Copy link
Contributor

The route /admin-settings was a redirect route before, however, the user is not yet loaded when the redirect hook gets called. This means we can't do ability checks there. Changes the route to a normal component route so we can do the ability check in the beforeEnter hook.

Also adds the correct type for the global app properties in the course of this and refactors a few apps to use it.

fixes #1330

@JammingBen JammingBen self-assigned this Oct 8, 2025
@JammingBen JammingBen marked this pull request as ready for review October 8, 2025 12:02
Copilot AI review requested due to automatic review settings October 8, 2025 12:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes admin settings route handling by converting the /admin-settings redirect route to a component route with proper ability checking in the beforeEnter hook, allowing for proper user permission validation since the user is loaded at that point.

  • Changes redirect route to component route with beforeEnter hook for admin settings
  • Adds GlobalProperties type definition for better type safety across app properties
  • Refactors multiple apps to use the new GlobalProperties type instead of generic ComponentCustomProperties

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/web-runtime/src/container/application/classic.ts Updates type casting to use GlobalProperties for better type safety
packages/web-pkg/src/apps/types.ts Adds comprehensive GlobalProperties interface and updates related type definitions
packages/web-app-search/src/index.ts Refactors to use useGettext composable instead of dummy function
packages/web-app-files/tests/unit/index.spec.ts Updates test mocks to use proper GlobalProperties typing
packages/web-app-files/src/index.ts Updates navItems function signature and removes dummy gettext function
packages/web-app-admin-settings/tests/unit/index.spec.ts Updates tests to reflect route change from redirect to beforeEnter hook
packages/web-app-admin-settings/src/index.ts Changes root route from redirect to component with beforeEnter hook for proper ability checking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 21 to 24
{
path: '/',
redirect: () => {
component: General,
beforeEnter: () => {
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route defines a component (General) but uses beforeEnter to redirect to other routes. This will cause the General component to be rendered briefly before the redirect occurs. Consider using a redirect route or a dedicated redirect component instead.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, the hook is called before entering the route and therefore mounting the component.

The route `/admin-settings` was a redirect route before, however, the user is not yet loaded when the `redirect` hook gets called. This means we can't do ability checks there. Changes the route to a normal component route so we can do the ability check in the `beforeEnter` hook.
@JammingBen JammingBen force-pushed the fix/admin-settings-redirect branch from 8a42361 to 8032b6d Compare October 8, 2025 12:21
Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@JammingBen JammingBen merged commit 7edd925 into main Oct 9, 2025
28 checks passed
@JammingBen JammingBen deleted the fix/admin-settings-redirect branch October 9, 2025 08:30
@openclouders openclouders mentioned this pull request Oct 9, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening the admin-settings in new tab fails

3 participants