-
Notifications
You must be signed in to change notification settings - Fork 31
feat: update default urls to new inbox a3 (v4-apps) #3846
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughAdds environment-detection helpers and centralizes Arbeidsflate URL construction; refactors messagebox/profile/archive URL functions to derive af.* root domains (or return local http URLs), deprecates partyId parameter in getMessageBoxUrl, and updates tests to expect af.* roots. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/publish |
PR release:
|
|
/publish |
PR release:
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/utils/urls/urlHelper.ts (2)
24-36: LGTM!The URL construction logic correctly handles production, test environments, and other cases. The environment-specific URL pattern (af.{env}.{domain}) aligns with the PR objectives for testing the new arbeidsflate URLs.
Consider adding a brief comment above line 35 explaining the fallback case (e.g., for staging environments) to improve maintainability:
+ // Fallback for other environments (e.g., staging) return `https://af.${altinnHost}/`;
88-129: Consider refactoring for consistency.While these functions haven't been migrated to use arbeidsflate URLs yet (they still point to old Altinn UI endpoints), consider these small improvements for consistency:
- Use
isLocalEnvironment(host)instead ofhost.match(localRegex)on lines 89, 108, and 120 to be consistent with the new helper pattern introduced in this PR.- Update the type signature on line 88 from
partyId?: number | undefinedtopartyId?: numberto match the cleanup done ingetMessageBoxUrl.Example for returnUrlToProfile:
-export const returnUrlToProfile = (host: string, partyId?: number | undefined): string | undefined => { - if (host.match(localRegex)) { +export const returnUrlToProfile = (host: string, partyId?: number): string | undefined => { + if (isLocalEnvironment(host)) { return `http://${host}/`; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/utils/urls/urlHelper.test.ts(2 hunks)src/utils/urls/urlHelper.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/utils/urls/urlHelper.test.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Avoid usinganyand unnecessary type casts (as Type) in TypeScript; prefer precise typings and refactor existing casts/anys
For TanStack Query, use objects to manage query keys and functions, and centralize shared options viaqueryOptions
Files:
src/utils/urls/urlHelper.ts
🧠 Learnings (1)
📚 Learning: 2025-09-08T10:35:54.904Z
Learnt from: bjosttveit
Repo: Altinn/app-frontend-react PR: 3676
File: .github/scripts/revert.sh:71-72
Timestamp: 2025-09-08T10:35:54.904Z
Learning: In the Altinn app-frontend-react repository, the Azure storage paths in revert.sh use the structure "$AZURE_TARGET_URI/toolkits/$APP_FULL/" and "$AZURE_TARGET_URI/toolkits/$APP_MAJOR/" without requiring "altinn-app-frontend" in the path.
Applied to files:
src/utils/urls/urlHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Install
- GitHub Check: Analyze (javascript)
- GitHub Check: Type-checks, eslint, unit tests and SonarCloud
🔇 Additional comments (8)
src/utils/urls/urlHelper.ts (8)
9-9: LGTM!The regex pattern correctly captures test environment identifiers (at/tt/yt with digits) and domain information needed for building arbeidsflate URLs.
11-13: LGTM!Clean helper function that improves code readability by encapsulating the local environment check.
15-18: LGTM!The function correctly extracts the Altinn host portion from the full hostname and safely handles cases where the pattern doesn't match.
20-22: LGTM!Simple and clear production environment detection.
38-44: LGTM!The party redirect logic correctly uses the old Altinn UI as an intermediary for party changes before redirecting to the new arbeidsflate URL. The undefined check prevents issues when base URL cannot be determined.
46-52: LGTM!Clean refactoring that improves code organization by using the new helper function while maintaining the same behavior.
75-86: LGTM!Clean refactoring that correctly uses the new helpers to build arbeidsflate URLs for archive redirection. The logic appropriately omits party redirection for archive URLs.
54-73: LGTM! Code verified with comprehensive test coverage.The function correctly implements the arbeidsflateUrl pattern with proper party redirection support. Tests comprehensively cover all environment scenarios (TT/AT/YT/production/local) and the party redirect flow is validated through integration tests in Presentation.test.tsx.
|
/publish |
PR release:
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/utils/urls/urlHelper.ts (1)
74-115: Consider usingisLocalEnvironmenthelper for consistency.The unchanged functions
returnUrlToProfile,returnUrlToAllForms, andlogoutUrlAltinnstill usehost.match(localRegex)directly, while the updated functions use the newisLocalEnvironmenthelper. For consistency and maintainability, consider refactoring these to use the helper as well.Example for
returnUrlToProfile:export const returnUrlToProfile = (host: string, partyId?: number | undefined): string | undefined => { - if (host.match(localRegex)) { + if (isLocalEnvironment(host)) { return `http://${host}/`; }Apply the same pattern to
returnUrlToAllFormsandlogoutUrlAltinn.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/utils/urls/urlHelper.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Avoid usinganyand unnecessary type casts (as Type) in TypeScript; prefer precise typings and refactor existing casts/anys
For TanStack Query, use objects to manage query keys and functions, and centralize shared options viaqueryOptions
Files:
src/utils/urls/urlHelper.ts
🧠 Learnings (1)
📚 Learning: 2025-09-08T10:35:54.904Z
Learnt from: bjosttveit
Repo: Altinn/app-frontend-react PR: 3676
File: .github/scripts/revert.sh:71-72
Timestamp: 2025-09-08T10:35:54.904Z
Learning: In the Altinn app-frontend-react repository, the Azure storage paths in revert.sh use the structure "$AZURE_TARGET_URI/toolkits/$APP_FULL/" and "$AZURE_TARGET_URI/toolkits/$APP_MAJOR/" without requiring "altinn-app-frontend" in the path.
Applied to files:
src/utils/urls/urlHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Type-checks, eslint, unit tests and SonarCloud
- GitHub Check: Analyze (javascript)
- GitHub Check: Install
🔇 Additional comments (3)
src/utils/urls/urlHelper.ts (3)
9-9: LGTM: Test environment regex pattern looks correct.The regex correctly matches test environment hosts like
at23.altinn.cloud,tt01.altinn.no, etc., and captures the necessary groups for URL construction.
11-36: LGTM: Environment detection and URL building helpers are well-structured.The new helper functions provide a clean abstraction for environment-aware URL construction. The logic correctly handles:
- Local development environments
- Production (altinn.no)
- Test environments (at/tt/yt with numbers)
- Staging and other environments (fallback)
The destructuring in line 31 correctly extracts the environment prefix and domain for constructing arbeidsflate URLs.
38-44: LGTM: Clean refactoring of returnBaseUrlToAltinn.The function now uses the extracted helper for better code organization while maintaining the same behavior and type safety.
|
/publish |
PR release:
|
|
/publish |
PR release:
|
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/urls/urlHelper.ts (1)
4-5: Remove unusedredirectAndChangePartyfunction at lines 4-5.The function is not exported and has no usages anywhere in the codebase. It should be deleted to eliminate dead code.
♻️ Duplicate comments (1)
src/utils/urls/urlHelper.ts (1)
46-63: Breaking change already flagged - callers need updates.The function signature change from
getMessageBoxUrl(partyId?: number)togetMessageBoxUrl(_partyId?: number)with updated behavior is a breaking change. As noted in past review comments, 5 call sites still pass the partyId argument and need to be updated to callgetMessageBoxUrl()with no parameters.The implementation logic itself is correct: it handles local environments, extracts the Altinn host, and delegates to
buildArbeidsflateUrl.
🧹 Nitpick comments (3)
src/utils/urls/urlHelper.ts (3)
78-90: Profile URL construction is correct.The function correctly handles local environments and appends
/profileto the arbeidsflate URL after removing the trailing slash. The_partyIddeprecation is documented appropriately.Optional: Simplify parameter signature.
The signature
_partyId?: number | undefinedis redundant; the optional operator?already includesundefined. Consider simplifying to_partyId?: number.Apply this diff to simplify the signature:
-export const returnUrlToProfile = (host: string, _partyId?: number | undefined): string | undefined => { +export const returnUrlToProfile = (host: string, _partyId?: number): string | undefined => {
92-102: UseisLocalEnvironmenthelper for consistency.The function still uses
host.match(localRegex)directly on line 93 instead of the newly introducedisLocalEnvironment(host)helper. For consistency with the refactored functions above, consider using the helper.Apply this diff:
export const returnUrlToAllForms = (host: string): string | undefined => { - if (host.match(localRegex)) { + if (isLocalEnvironment(host)) { return `http://${host}/`; }
104-114: UseisLocalEnvironmenthelper for consistency.Similar to
returnUrlToAllForms, this function useshost.match(localRegex)directly on line 105 instead of theisLocalEnvironment(host)helper. Update for consistency.Apply this diff:
export function logoutUrlAltinn(host: string): string | undefined { - if (host.match(localRegex)) { + if (isLocalEnvironment(host)) { return `http://${host}/`; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/utils/urls/urlHelper.test.ts(3 hunks)src/utils/urls/urlHelper.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/utils/urls/urlHelper.test.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Avoid usinganyand unnecessary type casts (as Type) in TypeScript; prefer precise typings and refactor existing casts/anys
For TanStack Query, use objects to manage query keys and functions, and centralize shared options viaqueryOptions
Files:
src/utils/urls/urlHelper.ts
🔇 Additional comments (4)
src/utils/urls/urlHelper.ts (4)
11-18: Well-structured helper functions.The new
isLocalEnvironmentandextractAltinnHosthelpers improve code organization and reusability. The optional chaining inextractAltinnHostsafely handles cases where the regex doesn't match.
24-36: Arbeidsflate URL construction logic is sound.The function correctly handles three cases:
- Production environment returns the canonical af.altinn.no URL
- Test environments (at/tt/yt + digits) extract environment prefix and domain to construct af.{env}.{domain} URLs
- Fallback handles other staging environments
All URLs are consistently returned with trailing slashes.
38-44: Clean refactor using new helpers.The refactored
returnBaseUrlToAltinnusesextractAltinnHostand returnsundefinedwhen the host cannot be determined, making the behavior explicit.
65-76: Consistent refactor using new helpers.The refactored
returnUrlToArchivefollows the same pattern asgetMessageBoxUrl, using the new helpers to handle local environments and construct arbeidsflate URLs. The explicitundefinedreturn is appropriate.
|
|
/publish |
PR release:
|



Description
Denne PR-en oppdaterer default lenker til innboks. Nå peker vi på ny innboks i altinn 3, istedenfor den gamle i altinn 2. Det samme gjelder profil.
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit
Bug Fixes
Improvements