feat(members): apply tags to a member - #64
Merged
Merged
Conversation
Tags could be created, renamed and deleted under Settings > System > Tags, but
there was no way to put one on a member: the member screens had no tag UI, and
the API layer only carried the tag CRUD endpoints, not the member-tag one. An
Android-only user could build a whole tag vocabulary and never use it.
Adds GET and PUT /v1/members/{id}/tags and a chip picker, following the
relationships editor on the same screens: editable in the member editor,
read-only on the profile, and rendering nothing in read-only mode when the
member has no tags, so it drops in unconditionally. Both are inside the
existing "existing members only" guard, since a member being created has no id
to attach tags to yet.
A tap applies immediately rather than waiting for the editor's Save. The tag
set is its own endpoint, not part of the member body that Save flushes, and the
relationships editor beside it already behaves this way.
The endpoint takes the member's complete tag set rather than a delta, so a
toggle that sent only the changed tag would silently strip every other tag off
the member. That is the main thing the tests pin, along with the rollback when
a write is refused: leaving a chip filled after a rejected save would report a
tag as stuck when it is not.
A system with no tags defined gets a pointer to where they are created instead
of an empty card. Listing the tag vocabulary is best-effort, so a viewer who
can read a member's tags but not list all of them still sees what is set.
Web shows this on the member profile only; on Android it is editable in the
editor and read-only on the profile, matching how relationships already work
here.
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.
Came out of a support question: "how do I add tags to a member?" The answer on Android was "you can't."
The gap
Settings > System > Tags lets you create, rename and delete tags. Nothing lets you put one on a member: no tag UI anywhere in the member screens, and the API layer only carried the tag CRUD endpoints (
/v1/tags), never the member-tag one. So an Android-only user could build an entire tag vocabulary and then have no way to use it.What's added
GETandPUT /v1/members/{id}/tags, plus a chip picker that follows the relationships editor on the same two screens:Both sit inside the existing "existing members only" guard, since a member being created has no id to attach tags to yet.
A tap applies immediately rather than waiting for the editor's Save. The tag set is its own endpoint, not part of the member body that Save flushes, and the relationships editor directly beside it already works this way.
The sharp edge
The endpoint takes the member's complete tag set, not a delta. A toggle that sent only the changed tag would silently strip every other tag off the member - no error, no warning, just quietly fewer tags. That's the main thing the 8 tests pin: adding sends the whole resulting set, removing sends the remainder, removing the last one sends an empty list rather than skipping the call.
They also cover the optimistic rollback: leaving a chip filled after a refused write would report a tag as stuck when it isn't.
Smaller calls
LaunchedEffectcan re-fire, and a reload that reset the selection would undo a toggle the user just made. Tested.Divergence from web
Web shows this on the member profile only. Here it's editable in the editor and read-only on the profile, matching how relationships already work on Android. Following the in-repo pattern seemed better than matching web's placement and having the two adjacent features behave differently.
Testing
:app:assemblePlayRelease,:app:assembleOpenRelease,:app:testPlayReleaseUnitTestgreen; 8 new unit tests.Device checklist: