Skip to content

Refactor magazine link visibility based on user authentication#66

Merged
natlibfi-psams merged 1 commit intomainfrom
Ekir-726-magazine-link-visibility
Feb 24, 2026
Merged

Refactor magazine link visibility based on user authentication#66
natlibfi-psams merged 1 commit intomainfrom
Ekir-726-magazine-link-visibility

Conversation

@natlibfi-psams
Copy link
Collaborator

Description

This pull request updates how the Magazines section is handled for authenticated and anonymous users.

User Authentication and Navigation:

  • The HeaderLinks component now conditionally displays the Magazines navigation button: authenticated users are linked to /magazines, while anonymous users are linked to /magazines-preview, both labeled simply as "Magazines".

Configuration and Environment Handling:

  • The getMagazineAllowedOrigin function now robustly validates the NEXT_PUBLIC_MAGAZINES_ORIGIN environment variable, falling back to default origins if the variable is invalid or missing.
    User Context and Token Handling:

  • The magazines index page ([library]/magazines/index.tsx) re-enables the use of the useUser hook to retrieve the actual user token, replacing the previous mock token implementation.

How Can This Be Tested?

  • This change cannot be tested visually
  • Tested locally
  • Tested on a mobile device
  • Tested with Firefox
  • Tested with Chrome
  • Tested with Edge
  • Tested with Safari

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Review added atleast to E-kirjasto maintainers +1

Copy link
Contributor

@natlibfi-burger natlibfi-burger left a comment

Choose a reason for hiding this comment

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

ok

@natlibfi-psams natlibfi-psams merged commit ba4c3e2 into main Feb 24, 2026
5 checks passed
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.

3 participants