Skip to content

feat: save chart tags with PUT/PATCH instead of the removed POST - #82

Merged
sparkbarry merged 2 commits into
mainfrom
barry/chart-tags-put-patch
Nov 8, 2026
Merged

sparkbarry merged 2 commits into
mainfrom
barry/chart-tags-put-patch

Conversation

@LeZi9916

@LeZi9916 LeZi9916 commented Nov 8, 2026

Copy link
Copy Markdown
Member

No description provided.

mmfcapi f8167e7 removed POST /maichart/{id}/tags and /publictags (they
now answer 405) and added PUT (replace with a string[] body) and PATCH
({ add, remove }). Both return the tags held after the request. This
must ship together with that backend.

- Private (uploader) tags have a single editor, so they are replaced
  with PUT of the whole list.
- Public tags are edited by many players, so the widget sends only this
  edit as PATCH { add, remove }, diffed against the tags it last read
  from the server; a replacing write would drop tags others added since
  the window was opened. The diff never lists a tag in both add and
  remove, so the backend 400 for that case cannot be triggered.
- The widget shows the tags the server returns (normalized, and merged
  with concurrent edits) and updates its SWR summary cache with them,
  instead of assuming its local list was saved as is.
- A failed request (including a network error) now always closes the
  loading toast and reports the failure.
mmfcapi now caps each kind of chart tag at 32 (counted after
normalization) and answers 400 with the new code TooManyElements = 40002
when a PUT, or a PATCH that grows the list, goes over it. A PATCH that
loses to concurrent edits three times now gets 409.

- Add CODE_TOO_MANY_ELEMENTS = 40002 to apiRetCode.
- The tag window refuses a 33rd tag (and duplicates) before sending and
  shows the limit, and shows the same message if the server answers
  40002 anyway (another player may have filled the list meanwhile).
- A public-tag PATCH that gets 409 is sent once more (PATCH is
  idempotent); if that conflicts too, the window asks to try again.
- New i18n keys TooManyTags and TagsChanged in all four languages.
@sparkbarry
sparkbarry merged commit 2b68d04 into main Nov 8, 2026
2 checks passed
@sparkbarry
sparkbarry deleted the barry/chart-tags-put-patch branch November 8, 2026 17:05
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