feat(audience): let group owners rename their groups (NPPD-1813)#460
Open
adekbadek wants to merge 4 commits into
Open
feat(audience): let group owners rename their groups (NPPD-1813)#460adekbadek wants to merge 4 commits into
adekbadek wants to merge 4 commits into
Conversation
Owners of multiple group subscriptions saw every card labelled "Group" in
the My Account group picker, with no way to tell them apart. Add a reader-facing
rename affordance:
- New `POST /name` route on the group-subscription REST API. Reuses the
manager/admin permission callback. Renaming is metadata-only, so unlike
member/invite changes it is not state-gated (an owner can rename a cancelled
or expired group). An empty name clears the override, falling back to the
product name then the default group label. Name length is capped to
GROUP_NAME_MAX_LENGTH.
- A pencil ghost button in the group page header (Group {pencil} [Active])
opens a small modal with a name input and stacked Save/Cancel actions, per
design. On save the header and picker reflect the new name.
The name is persisted to the existing `_newspack_group_subscription_name` meta,
already honoured by the picker, header, and admin meta box.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Q8L6Wb1ZhTf7AS4Jp3wjK
- Move GROUP_NAME_MAX_LENGTH to Group_Subscription_Settings (owns the name meta); the template no longer imports Group_Subscription_API just for the constant. - Seed the rename input from the stored custom name (empty when the group uses an inherited fallback) and show the resolved fallback as the placeholder, so the "clear to reset" affordance reads cleanly. Track the typed value in JS so it survives a rename without a page reload. - Read the subscription id from the rename form's own data-subscription-id so the feature is self-contained rather than coupled to the invite-link panel element. - Extract a withLoadingButton() helper, removing the third copy of the loading-state boilerplate (now shared by generate/delete/rename). - Drop the dead group_name_update_failed label (JS uses the form's data-error-text, matching the invite-link flow); fix the stale "PATCHes" comment (the request is POST). - Tests: add route-dispatch coverage for the new permission surface (non-manager denied) and arg sanitization (markup stripped), plus the 404 branch; clarify the empty-name fallback test name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Q8L6Wb1ZhTf7AS4Jp3wjK
…PPD-1813) Round-2 review follow-up: drop the `|| subId` fallback so the rename request's subscription id comes only from the form's own data-subscription-id. A missing attribute now surfaces as a failed request rather than silently falling back to the invite-panel id, and the comment no longer over-claims full independence. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Q8L6Wb1ZhTf7AS4Jp3wjK
Per design feedback, the "Group name" label in the rename modal is now screen-reader-only (screen-reader-text). The label stays associated with the input via `for`, so the input keeps its accessible name; only the visible text is dropped for a cleaner modal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Q8L6Wb1ZhTf7AS4Jp3wjK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Owners of multiple group subscriptions saw every card labelled "Group" in the My Account group picker, with no way to tell them apart (NPPD-1813). This adds a reader-facing way to rename a group, following @thomasguillot's design direction (pencil button in the header → small modal).
POST /nameroute on the group-subscription REST API (newspack-group-subscription/v1/name). Reuses the existing manager/adminpermission_callback. Renaming is metadata-only, so unlike member/invite changes it is not state-gated — an owner can still rename a cancelled or expired group to tell them apart in the picker. An empty name clears the override, falling back to the product name and then the default group label. Length is capped toGROUP_NAME_MAX_LENGTH(100), mirrored by the input'smaxlength.Group {pencil} [Active]) with tooltip +aria-label, opening a smallnewspack-uimodal with a name input and stacked Save/Cancel actions. On save, the header and the picker cards reflect the new name (via adata-group-namehook)._newspack_group_subscription_namemeta, already honoured by the picker, the header, and the admin meta box, so no data-model change was needed.Closes NPPD-1813.
How to test the changes in this Pull Request:
NEWSPACK_CONTENT_GATESon, create a reader who owns two group-enabled subscriptions with no custom name (both will show as "Group")./my-account/group/— confirm the picker shows two indistinguishable "Group" cards.Other information:
Test_Group_Subscription_APIcases: persist, trim, empty→fallback, length cap, allowed-on-cancelled.)🤖 Generated with Claude Code