Page MenuHomePhabricator

Allow DiscussionTools edits to succeed when a failed edit creates a temp account and user resubmits the edit
Closed, ResolvedPublic

Description

Steps to reproduce

image.png (1×1 px, 173 KB)

The patches in T359405: Create temporary account early in edit cycle for all edit attempts mean that MediaWiki will create a temporary account on edit attempts. This means that a failed edit attempt will result in the user being logged-in to a temporary account.

This causes problems for API editing via Discussion Tools (see T367843: Can't save changes in DiscussionTools when temp accounts are enabled: "You are no longer logged out, so the action could not be completed."), because after the initial failed edit attempt, the user is logged-in, but Discussion Tools still assume the user is not logged-in. In VisualEditor, this is less of an issue because it can use the ve.init.mw.Target.prototype.refreshUser mechanism to update the user account.

We need some special handling in the error response in DiscussionTools to check if the user is now logged-in as a temp account.

As a bonus, it would be nice to also then load the temp account banner, but that probably should be split out into its own task.

Acceptance criteria:

  • Anonymous editor who fails an edit because of triggering a CAPTCHA and is then logged-in as a temp account should be able to save the edit after filling the CAPTCHA

Timing

Per discussion with @kostajh offline, the Editing Team is committed to resolving this issue before August 2024 is over.

Event Timeline

Actually, it looks like VisualEditor is already OK, because it has functionality in ve.init.mw.Target.prototype.refreshUser which can handle this use-case. So this is just about DiscussionTools, and for that, we can use the existing T367843: Can't save changes in DiscussionTools when temp accounts are enabled: "You are no longer logged out, so the action could not be completed.".

kostajh renamed this task from Allow VisualEditor and DiscussionTools edits to succeed when a failed edit creates a temp account to Allow DiscussionTools edits to succeed when a failed edit creates a temp account.Jun 25 2024, 6:11 PM
kostajh updated the task description. (Show Details)
kostajh added a project: Editing-Team-Request.
kostajh added a subscriber: matmarex.
kostajh added subscribers: DLynch, Esanders.
kostajh renamed this task from Allow DiscussionTools edits to succeed when a failed edit creates a temp account to Allow DiscussionTools edits to succeed when a failed edit creates a temp account and user resubmits the edit.Jun 25 2024, 6:14 PM
kostajh updated the task description. (Show Details)
kostajh updated the task description. (Show Details)

Change #1067437 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Reattempt the save when something already created a temporary account

https://gerrit.wikimedia.org/r/1067437

Change #1067437 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Reattempt the save when something already created a temporary account

https://gerrit.wikimedia.org/r/1067437

Djackson-ctr subscribed.

QA has been completed and the new code is functioning and displaying as expected (user will NOT get the error message "You are no longer logged out, so the action could not be completed.")...
Also this passes the Acceptance Criteria (Anonymous editor who fails an edit because of triggering a CAPTCHA and is then logged-in as a temp account will be able to save the edit after filling the CAPTCHA).