Repository navigation
feat: save chart tags with PUT/PATCH instead of the removed POST - #82
Merged
Merged
Conversation
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.
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.
No description provided.