Skip to content

Clean up useUser role surface: add hasRole, remove userKind, migrate call sites#14769

Open
rtibblesbot wants to merge 9 commits into
learningequality:developfrom
rtibblesbot:issue-14758-6eb61e
Open

Clean up useUser role surface: add hasRole, remove userKind, migrate call sites#14769
rtibblesbot wants to merge 9 commits into
learningequality:developfrom
rtibblesbot:issue-14758-6eb61e

Conversation

@rtibblesbot
Copy link
Copy Markdown
Contributor

@rtibblesbot rtibblesbot commented May 27, 2026

Summary

Adds hasRole to useUser, removes userKind, and migrates all call sites off the patterns in #14758.

One intentional behaviour change: !isLearner privilege gates become hasRole, which no longer matches anonymous sessions (previously, anonymous visitors could satisfy !isLearner).

References

Closes #14758

Reviewer guidance

The isAdmin || isSuperuserisAdmin simplifications in NotificationsRoot and SideNav rely on isAdmin already covering superusers — confirmed at useUser.js:78 where isAdmin checks for UserKinds.SUPERUSER explicitly.

StorageNotification.vue retains two positive isLearner checks (lines 129, 137) — only the negated gate moved to hasRole.

AI usage

Implemented with Claude Code following a pre-written plan. I verified the isAdmin includes-superuser assumption by reading useUser.js:78 before simplifying isAdmin || isSuperuser patterns, and ran the full test suite for all affected packages.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

rtibblesbot and others added 9 commits May 27, 2026 11:55
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rTypeDisplay

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…SideNav

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…earningFooter, StorageNotification

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: frontend SIZE: medium labels May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

npm Package Versions

Warning

The following packages have changed files but no version bump:

Package Version Changed files
kolibri 0.18.0 6

If these changes affect published code, consider bumping the version.

@rtibblesbot rtibblesbot marked this pull request as ready for review May 27, 2026 20:36
rtibbles
rtibbles previously approved these changes May 27, 2026
Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Good to go!

@rtibbles rtibbles dismissed their stale review May 27, 2026 21:41

Sorry, got over excited - I'll do some manual testing before we merge.

@rtibblesbot
Copy link
Copy Markdown
Contributor Author

Thanks for the review, @rtibbles!

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

Labels

APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: frontend SIZE: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify useUser role exports: add hasRole, remove userKind

2 participants