Skip to content

feat(admin): explain who can edit a manager, and add a Need help? link to the header - #1238

Merged
Ardnived merged 9 commits into
mainfrom
claude/feat-manager-edit-notice
Nov 21, 2026
Merged

Ardnived merged 9 commits into
mainfrom
claude/feat-manager-edit-notice

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What

A read-only warning on a manager you can't edit. When a non-admin opens another manager, a warning appears at the top of the edit form: "You can't edit this manager. An admin, or the manager themself, can make this change." It has an Email support button, a mailto: to CONTACT_EMAIL. Admins never see it, and neither does a manager looking at their own record.

A "Need help?" button on every admin page, to the right of the locale select (language, help, account picture). It is a mailto: to the same address.

How

  • The warning is a ui field, the first in Managers.fields (ManagerEditNotice). It renders when Payload's own per-document hasSavePermission is false, so it follows accessPlugin rather than restating its rules. Payload draws the auth block (Email, Verified) ahead of every field and offers no slot before it, so the warning sits directly below that block. In practice a non-admin reaches another manager only through a document drawer, from an event's Manager or a region's Managers field. managers is hidden from them, so Payload answers the full-page route with a 404.
  • The button mounts through admin.components.actions and portals itself. Payload's header has no slot to the right of the localizer. Actions render to its left, and the localizer is positioned absolutely outside the header's clipped row. NeedHelpButton therefore portals itself into .app-header and publishes its width as --need-help-width. custom.scss uses that width to move the localizer and its hidden spacer in. The :has(.need-help) rule deliberately outranks the phone localizer rule: it restates that rule's offset (gutter + account picture + gap) plus the button's width, at every width. The open phone nav hides the button along with the localizer.
  • src/fixture/views.ts lists both components. need-help and --need-help-width join the allowlists in admin-custom-css.spec.ts.

Built-ins used: InfoBanner (Payload's Banner, warning type) and Payload's Button el="anchor".

Preview

  • Event 1025004 — sign in as Rafael Quintero (1001002, a region manager), then click the edit icon on Manager (Ingrid Valtonen, 1001006). The warning sits at the top of the drawer's form. Signed in as an admin, it does not show.
  • Dashboard — "Need help?" sits between the locale select and the account picture on every admin page. Narrow the window to a phone width to check the spacing there.

Testing

  • tests/unit/need-help-button.spec.ts (jsdom) checks that the button portals into the header, publishes its width there, and clears the width on unmount.
  • The lean gate (check.sh) passes.
  • Checked by hand on a local dev server with fixture data:
    • The warning shows in Rafael's drawer for manager 1001006, and does not show for an admin.
    • The header reads localizer → help → account at 1280px and at 390px, 12px apart, with no overlap.

🤖 Generated with Claude Code

…k to the header

A non-admin opening another manager (from an event's or a region's
manager picker) now sees a notice at the top of the drawer: only an admin
or the manager themself can edit a manager, with the support address and
an Email support button. It shows only when Payload reports no save
permission on that document.

Every admin page gets a "Need help?" button to the right of the locale
select, a mailto: to CONTACT_EMAIL. Payload has no header slot there, so
it mounts as a header action and portals itself beside the localizer,
which custom.scss moves in by the button's width.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1238 November 20, 2026 22:33 Destroyed
@railway-app

railway-app Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1238 environment in sahajcloud

Service Status Web Updated
SahajCloud 😴 Sleeping (View Logs) Web Nov 21, 2026 at 12:51 am UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot

sydevs-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running
CI fix 1

recent dispatches
  • 23:49Z fix-ci · attempt 1 · session · done
  • 23:49Z fix-ci · attempt 1 · session
  • 22:57Z address-review · attempt 1 · session · done
  • 22:57Z address-review · attempt 1 · session
  • 22:48Z review-pr · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 20, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

The notice half is right: a notice over InfoBanner reads like EventScheduleNotice, and hasSavePermission is Payload's own answer, not a copy of the access rule. The header half is the opposite — six bespoke pieces, two of them repo firsts, to move a button from the left of the localizer to its right, which nothing requires. custom.scss now carries a third independent override of that one absolutely-positioned localizer, and the newest kills the oldest. One header-layout block would be the systemic answer to all three.

Findings

What was checked. Read whole: both new components, custom.scss, Managers.ts, InfoBanner, fixture/views.ts, both specs. Ladder: InfoBanner and CONTACT_EMAIL already existed and are reused; createPortal has one precedent (AtlasNav/HoverTooltip); useLayoutEffect and ResizeObserver have none in src/. Fixture: 1025004 is EVENT_IDS.escalated, its manager is 1001006, and 1001002 is the region manager — the walkthrough holds. The copy is accurate against plugins/access/config/roles.ts. English literals match every other notice here, so not raised. Payload's header markup was not read: no node_modules here, so "no slot there" is taken as stated.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/app/(payload)/custom.scss Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 20, 2026
The right-of-localizer position was nobody's requirement, and it cost a
portal, a marker span, a useLayoutEffect, a ResizeObserver, a custom
property written onto Payload's own node, and 28 lines of custom.scss.
Payload's actions row already draws an action in the header, in flow,
left of the localizer, and bounds its width per breakpoint.

That also retires the `:has(.need-help)` rule, which at 0,4,0 outranked
the phone localizer fix at 0,2,0 and so killed it at every width.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYdMpBbiNE6D6w7zjV
The banner spelled the address in prose beside its own Email support
button. The prose goes; the button is InfoBanner's one control, and it is
the only route reachable here — the drawer is fixed and 100vh over a
header at the same z-index, so the header's own button sits behind it.

Dropping "Only" also stops the sentence claiming exclusivity it reads off
nothing: who may edit a manager is a role grant that can widen, and the
notice already shows only when Payload reports no save permission.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYdMpBbiNE6D6w7zjV
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1238 November 20, 2026 23:10 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor

Four critic threads answered in two commits. origin/main merged in cleanly.

  • Placement machinery — adopted, 82a54fe. Payload's own actions row places the button, so the portal, the marker span, the useLayoutEffect, the ResizeObserver, the custom property, 28 lines of custom.scss and need-help-button.spec.ts are gone.
  • :has() outranks the phone fix — adopted, same commit: the rule is gone and the phone offset is live again.
  • Three routes to one mailto — adopted in part, d9f3711. Prose route and third spelling gone. The button stays: the drawer paints over the header at the same --z-modal.
  • The sentence restates the access rule — adopted, d9f3711. Dropping Only removes what can drift.
  • Review body, no ## Preview section — added, one link per fixture surface.

Lean gate green: lint, format, both typechecks, 3843 unit specs. /security-review ran on the src/components/admin/ trigger: nothing found.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 20, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is

@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 20, 2026
Ardnived and others added 2 commits November 20, 2026 16:32
The notice moves from the drawer's header (the collection Description
slot) to the first field of the edit form, and becomes a warning. Payload
draws the auth block (Email, Verified) ahead of every field with no slot
before it, so the notice sits directly below that block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived enabled auto-merge November 20, 2026 23:40
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1238 November 20, 2026 23:40 Destroyed
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 20, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 20, 2026
The read-only notice is a top-level `ui` field ahead of `name`, so the
tabs field sits at position 3 among Managers' fields, not 2.
`seedTabPreference` reads that position off the sanitized config and
followed the move; the spec pins the literal Payload writes, so it did
not.

Payload indexes an unnamed field by its place in the parent's field
array, counting a `ui` field, and appends the auth fields rather than
prepending them — so the admin writes `_index-3` here too.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYm89ZFjtQ8AurVPxB
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1238 November 20, 2026 23:55 Destroyed
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 20, 2026
@Ardnived
Ardnived added this pull request to the merge queue Nov 21, 2026
@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 21, 2026
This reverts commit 82a54fe. The position to the right of the locale
select is the owner's requirement for this PR (Ardnived, 2026-11-20), so
the portal and the custom.scss offsets that make it work come back.

The `:has(.need-help)` rule does outrank the phone localizer rule, on
purpose: it restates that rule's offset (gutter + account picture + gap)
plus the button's width at every width, so the phone layout keeps its
spacing. Checked at 390px and 1280px.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived removed this pull request from the merge queue due to a manual request Nov 21, 2026
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1238 November 21, 2026 00:20 Destroyed
@Ardnived
Ardnived enabled auto-merge November 21, 2026 00:27
@Ardnived
Ardnived added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit eef5276 Nov 21, 2026
10 checks passed
@Ardnived
Ardnived deleted the claude/feat-manager-edit-notice branch November 21, 2026 00:52
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 21, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1238 — 0a63be39 Deployed Nov 21, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants