Skip to content

Conversation

@framitdavid
Copy link
Contributor

@framitdavid framitdavid commented Nov 12, 2025

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

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • Bug Fixes

    • Inbox, archive and profile links now consistently resolve to af.* domains in test and production, reducing incorrect domain links.
    • Local or missing host scenarios now return safe local URLs or no URL, reducing broken redirects.
  • Improvements

    • URL resolution simplified and standardized across environments; party selection is now handled by Arbeidsflate, not by this app.
    • PartyId usage for link construction is deprecated and no longer affects generated links.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
URL helpers & environment logic
src/utils/urls/urlHelper.ts
Added internal helpers: isLocalEnvironment, extractAltinnHost, isProductionEnvironment, buildArbeidsflateUrl, and testEnvironmentRegex. Refactored flows so getMessageBoxUrl, returnUrlToProfile, and returnUrlToArchive derive af.* Arbeidsflate roots (or return local http URLs). `getMessageBoxUrl(_partyId?: number): string
Updated tests
src/utils/urls/urlHelper.test.ts
Tests updated to expect af.* base domains for TT/AT/YT/Prod cases for messagebox/profile/archive helpers; Docker/Podman and Studio/local expectations unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check extractAltinnHost and testEnvironmentRegex for edge-case hostnames and uncommon subdomain patterns.
  • Verify buildArbeidsflateUrl produces correct af.* roots (including protocol) for non-local and production variants.
  • Confirm callers and tests handle possible undefined from getMessageBoxUrl and that ignored partyId usages are intentionally deprecated.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: update default urls to new inbox a3 (v4-apps)' accurately describes the main change—updating URLs to point to the new Altinn 3 inbox instead of Altinn 2, which aligns with the code changes refactoring URL helpers to use Arbeidsflate URLs.
Description check ✅ Passed The description provides a clear explanation of changes (in Norwegian), includes a related issue link, and follows the template structure with all major verification/QA sections present, though many checklist items remain unchecked.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/new-urls-to-inbox

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5bc026 and a93f0a2.

📒 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 (2)
  • src/utils/urls/urlHelper.test.ts
  • 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: Analyze (javascript)
  • GitHub Check: Install
  • GitHub Check: Type-checks, eslint, unit tests and SonarCloud

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2971.new-urls-to-inbox.01813fb9/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2971.new-urls-to-inbox.01813fb9/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2982.new-urls-to-inbox.f5c470d8/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2982.new-urls-to-inbox.f5c470d8/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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:

  1. Use isLocalEnvironment(host) instead of host.match(localRegex) on lines 89, 108, and 120 to be consistent with the new helper pattern introduced in this PR.
  2. Update the type signature on line 88 from partyId?: number | undefined to partyId?: number to match the cleanup done in getMessageBoxUrl.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 01813fb and f5c470d.

📒 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 using any and 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 via queryOptions

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.

@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2993.new-urls-to-inbox.e42417a9/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2993.new-urls-to-inbox.e42417a9/altinn-app-frontend.js"></script>

⚙️ Building...
❌ Failed: https://github.com/Altinn/app-frontend-react/actions/runs/19293250146

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 using isLocalEnvironment helper for consistency.

The unchanged functions returnUrlToProfile, returnUrlToAllForms, and logoutUrlAltinn still use host.match(localRegex) directly, while the updated functions use the new isLocalEnvironment helper. 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 returnUrlToAllForms and logoutUrlAltinn.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5c470d and e42417a.

📒 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 using any and 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 via queryOptions

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.

@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2996.new-urls-to-inbox.7a3a5c23/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.2996.new-urls-to-inbox.7a3a5c23/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

@framitdavid framitdavid changed the title feat: update urls for back to innboks feat: update default urls to new inbox a3 (v4-apps) Nov 12, 2025
@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.3016.new-urls-to-inbox.c5bc0265/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.3016.new-urls-to-inbox.c5bc0265/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 unused redirectAndChangeParty function 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) to getMessageBoxUrl(_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 call getMessageBoxUrl() 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 /profile to the arbeidsflate URL after removing the trailing slash. The _partyId deprecation is documented appropriately.

Optional: Simplify parameter signature.

The signature _partyId?: number | undefined is redundant; the optional operator ? already includes undefined. 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: Use isLocalEnvironment helper for consistency.

The function still uses host.match(localRegex) directly on line 93 instead of the newly introduced isLocalEnvironment(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: Use isLocalEnvironment helper for consistency.

Similar to returnUrlToAllForms, this function uses host.match(localRegex) directly on line 105 instead of the isLocalEnvironment(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

📥 Commits

Reviewing files that changed from the base of the PR and between 7a3a5c2 and c5bc026.

📒 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 using any and 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 via queryOptions

Files:

  • src/utils/urls/urlHelper.ts
🔇 Additional comments (4)
src/utils/urls/urlHelper.ts (4)

11-18: Well-structured helper functions.

The new isLocalEnvironment and extractAltinnHost helpers improve code organization and reusability. The optional chaining in extractAltinnHost safely handles cases where the regex doesn't match.


24-36: Arbeidsflate URL construction logic is sound.

The function correctly handles three cases:

  1. Production environment returns the canonical af.altinn.no URL
  2. Test environments (at/tt/yt + digits) extract environment prefix and domain to construct af.{env}.{domain} URLs
  3. Fallback handles other staging environments

All URLs are consistently returned with trailing slashes.


38-44: Clean refactor using new helpers.

The refactored returnBaseUrlToAltinn uses extractAltinnHost and returns undefined when the host cannot be determined, making the behavior explicit.


65-76: Consistent refactor using new helpers.

The refactored returnUrlToArchive follows the same pattern as getMessageBoxUrl, using the new helpers to handle local environments and construct arbeidsflate URLs. The explicit undefined return is appropriate.

@sonarqubecloud
Copy link

@framitdavid
Copy link
Contributor Author

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

PR release:

  • <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.3022.new-urls-to-inbox.a93f0a22/altinn-app-frontend.css">
  • <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.23.1-pr.3022.new-urls-to-inbox.a93f0a22/altinn-app-frontend.js"></script>

⚙️ Building...
✅ Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

80 % dekning innen 1. desember (v4 + backport v3)

1 participant