Page MenuHomePhabricator

Prevent DiscussionTools from setting preferences for temporary accounts
Closed, ResolvedPublic

Description

Following T335971, it appears the extension is saving preferences for temporary users.
Update the code to treat temporary users like anon users.

Wherever these do something different based on whether a user is anonymous or registered, they may need updating (including comments).

Tests and comments should also be updated.

Notes
To help with searching:

In PHP preferences are saved via UserOptionsManager::saveOptions
In JS preferences are saved via methods defined on options.js: https://gerrit.wikimedia.org/g/mediawiki/core/+/809d4c9a9dd2cff6321cdae7a41e75b6c362cbbd/resources/src/mediawiki.api/options.js

Event Timeline

Aklapper removed a subscriber: Editing-team.

(Please add codebase project tags to tasks when possible, so such tasks can be found when looking for open tasks related to that codebase - thanks!)

matmarex moved this task from Backlog to Triaged on the DiscussionTools board.
matmarex subscribed.

When I was working on T332432 earlier, I thought there wasn't any code to update in DiscussionTools, but looking again now, I see we actually have some preference-setting code that may run for temp users. Thanks for the reminder to check.

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

[mediawiki/extensions/DiscussionTools@master] Don't try to set preferences for temporary accounts

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

Change 926595 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Don't try to set preferences for temporary accounts

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

Ryasmeen added a project: Verified.
Ryasmeen subscribed.

Checked this in the following ways:

  1. For logged in users user preferences are getting stored via mw.user.options.set and not for temp users

Logged in users:

Screenshot 2023-10-18 at 8.37.00 PM.png (1×2 px, 1 MB)

Temp users:

Screenshot 2023-10-19 at 3.40.55 PM.png (1×2 px, 739 KB)

  1. For logged in users, certain actions inside DT such as switching the editor or opening the Advanced mode inside Reply tool/New Topic tool are getting stored via user preferences. mw.user.options.get ('discussiontools-editmode') returns the last editor the user has switched to and mw.user.options.get ('discussiontools-showadvanced') returns 1 when the Advanced mode has been kept opened since the last time.

Screenshot 2023-10-18 at 9.40.14 PM.png (1×2 px, 437 KB)

For temp users, this selection for edit mode or for showing Advanced mode does not get stored.

Screenshot 2023-10-19 at 4.17.32 PM.png (1×2 px, 527 KB)

Screenshot 2023-10-19 at 4.16.41 PM.png (1×2 px, 609 KB)