This task is a follow-up task for T217774: Structured Discussions exposes user’s IP address if logged out in other browser window/tab as per @Tgr comment https://phabricator.wikimedia.org/T217774#5939958.
Possible follow-ups:
- cover the template-based code paths (as per the code review comment)
- decent error handling on resolve/unresolve (c575674)
- make the error message easier to understand for the user (could replace the API error with something custom in getApiErrorMessage)
Presently, there are several issues with handling logged-out users (users who logged out in another tab/window).
(1) The warning message is not present in the beginning of editing.
- a user is logged out (and not aware of it) starts editing and receives no warning.
In contrast, for an anon user the warning will be displayed on Structured discussions when a user starts to edit:
(2) When a logged-out user attempts to save an edit - the displayed warning message does not communicate clearly
- what exactly happen (the language of the warning is too technical)
- does not provide any info to a user what options a user has for editing (log in again or publish as anon edit).
Both, VE and wikitext editor do a good job to communicate to users what happened and what next steps might be:
(3) If a logged-out user confused by "Assertion that the user is logged in failed" message would change the editor (to VE or wikitext) even more enigmatic message will be displayed:
(minor) (4) Unnecessary confirmation dialog box if a user decides to cancel their edits: