Skip to content

P2: Linked-account “Acting as …” chip + principal prefs - #27

Merged
sandervonk merged 1 commit into
mainfrom
cursor/p2-acting-as-chip-a6b8
Sep 3, 2026
Merged

P2: Linked-account “Acting as …” chip + principal prefs#27
sandervonk merged 1 commit into
mainfrom
cursor/p2-acting-as-chip-a6b8

Conversation

@sandervonk

Copy link
Copy Markdown
Member

Summary

Adds an Acting as [school email] chip for personal/linked sessions, plus a small principal-write fix so calendar prefs land on the school doc.

Changes

Chip / chrome

  • Derived store getters: school_uid_claim, is_acting_as_linked, acting_as_email, acting_as_label (prefer ID-token school_uid; fall back to personal_account && linked_to; email from active_doc only)
  • Portal RightBar + Admin sidebar: linked icon kept, enhanced with chip + title/aria-label
  • Settings linked section: same chip
  • BaseNav auth button: tooltip/aria when acting as
  • After acceptLink: refresh_id_token_claims(true) so school_uid lands before board/stats/survey apiFetch
  • Claims also loaded on set_user

Principal correctness

  • Bug fixed: set_account_pref (and Settings calendar toggles) were writing prefs to the personal account_ref while spreading active_doc.prefs — school fields onto the personal uid doc
  • Now calendar prefs (derank_notes / hide_finished) read/write via active_doc / active_ref
  • Theme / email / timeout prefs remain on the signed-in wrapper (account_doc) as before
  • finished[], notes, surveys, enroll, update_remote already targeted active_doc — left as-is
  • Did not reintroduce personal_account → is_teacher false
  • Vue-only; no rules/callable changes

Tests / CI

  • scripts/test-acting-as.mjs + npm run test:acting-as
  • Wired into .github/workflows/ci.yml beside me-board tests

Files

  • src/common/actingAs.ts (new)
  • scripts/test-acting-as.mjs (new)
  • src/store/index.ts
  • src/components/Portal/RightBar.vue
  • src/views/Admin/Admin.vue
  • src/views/Portal/SettingsModal.vue
  • src/components/Home/BaseNav.vue
  • src/components/Portal/CalendarBlock.vue
  • package.json, .github/workflows/ci.yml

Success checks

  • Linked personal session shows Acting as school email in portal + settings
  • Non-linked org login: no chip
  • Link/unlink/enroll contracts unchanged
  • CI green
Open in Web Open in Cursor 

Show "Acting as [school email]" in portal RightBar/Admin/Settings
(and BaseNav tooltip) when school_uid claim or personal+linked_to.
Write calendar prefs to active school doc; refresh ID token claims
after acceptLink; add acting-as unit tests to CI.

Co-authored-by: Sander Vonk <sandervonk@users.noreply.github.com>
@sandervonk
sandervonk marked this pull request as ready for review September 3, 2026 00:44
@sandervonk
sandervonk merged commit 2b5e40d into main Sep 3, 2026
1 check passed
@sandervonk
sandervonk deleted the cursor/p2-acting-as-chip-a6b8 branch September 3, 2026 00:45
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.

2 participants