AnkiHubSoftware / ankihub_addon

3 stars 0 forks source link

[BUILD-773] fix: Show update-addon dialog when api version not supported #1030

Closed RisingOrange closed 3 weeks ago

RisingOrange commented 3 weeks ago

Related web app PR: https://github.com/AnkiHubSoftware/ankihub/pull/2411

We changed the API version and this requires users to update the addon. When this happens, the add-on should show a message that it need to be update. However, it shows an error message instead.

Related issues

https://ankihub.atlassian.net/jira/software/c/projects/BUILD/boards/1?selectedIssue=BUILD-773 Sentry: https://ankihub.sentry.io/issues/5458237219/?project=6546414&query=is%3Aunresolved%20406&referrer=issue-stream&statsPeriod=7d&stream_index=0 Discourse: https://community.ankihub.net/t/406-error-master-thread/335342

Proposed changes

We were expecting this to be true for the response (on the client-side):

response.reason="Outdated client, please update the AnkiHub add-on."

This works locally, but when communicating with the production server response.reason doesn't contain the custom message, instead it contains the default reason for responses with the status code 406 (Not Allowed).

To fix this, we will now return the message in the content of the response instead of in the reason and the client will be adjusted accordingly.

How to reproduce

Try the same thing with the api version set to 19.0. In this case the deck management dialog should open as usual.