Currently if you lose session (get logged out) while having Special:Translate open, and then try to Translate a message, a following happens:
mw.api.post fails due to invalid token. It tries to re-fetch the token, which fails as well. It will then cache this error [1]. The translation will go to "unsaved" state, which does not have yellow highlight, so it is hard to spot. If you open such a message you will see that saving failed due to "Unknown error".
[1] While debugging you wont see any ajax requests being made for saving. This confused me for a long while while debugging.
Suggested behavior as incremental improvements:
- Those messages should get the "saving failed" label.
- The error message should say that session has expired.
- We should detect the situation and display a modal alert asking the user to log in another tab to prevent creating further unsaved work.
- We should detect the situation and provide login via ajax and immediately retry saving the translation.
Version: master
Severity: major