Page MenuHomePhabricator

Make ApiOptions unavailable to temporary users
Closed, ResolvedPublic2 Estimated Story Points

Description

ApiOptions (used for setting preferences) throws a 'notloggedin' error for anonymous users. It should do the same for temporary users.

mw.Api#saveOptions (in JS) calls ApiOptions, and currently skips the API request for logged-out users. It should do the same for temporary users.

Testing Notes

  • As a temporary user, access the API sandbox ,e.g. http://localhost:8080/wiki/Special:ApiSandbox.
  • Select the "options" module in the "action" parameter dropdown. Fill in the required parameters, such as the token and an option that you want to change (e.g., changing the 'language' to 'es') and make the API request.
  • Check the response to ensure that you receive an error or a message indicating that temporary users cannot update user options.
  • Also Test API calls as a registered user and an anonymous user to make sure the response is as expected.

Event Timeline

Tchanders set the point value for this task to 1.

Request from me: please also update mw.Api#saveOptions in JS, which calls ApiOptions, and currently checks for logged-out users to skip the API request.

Tchanders changed the point value for this task from 1 to 2.

Request from me: please also update mw.Api#saveOptions in JS, which calls ApiOptions, and currently checks for logged-out users to skip the API request.

Thanks - task updated

Change 901672 had a related patch set uploaded (by Cyndywikime; author: Cyndywikime):

[mediawiki/core@master] Make ApiOptions unavailable to temporary users

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

Change 901672 merged by jenkins-bot:

[mediawiki/core@master] Make ApiOptions unavailable to temporary users

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

@Cyndymediawiksim I just wanted to validate with you that the results below are as expected before I move this to Done.

OS: macOS 13.2
Browsers: Safari 16.3, Chrome 111, Firefox 111
Environment: Local

API Request Response

UserAPI Options
Temp User
T332414_IPMasking_APIOptions_TempUser.png (691ร—3 px, 210 KB)
Not Logged In
T332414_IPMasking_APIOptions_NotLoggedIn.png (603ร—3 px, 195 KB)
Admin
T332414_IPMasking_APIOptions_Admin.png (571ร—3 px, 169 KB)

API Sandbox Auto-fill token- I just wanted to check that when you are not logged in, that auto-fill the token would only input "+\" compared to the rest getting numbers

T332414_IPMasking_APIOptions_TempUser_Token.png (993ร—2 px, 236 KB)
T332414_IPMasking_APIOptions_NotLoggedIn_Token.png (1ร—3 px, 250 KB)

API Sandbox Auto-fill token- I just wanted to check that when you are not logged in, that auto-fill the token would only input "+\" compared to the rest getting numbers

Yes, this is an old known issue documented at T40417.

@Cyndymediawiksim I just wanted to validate with you that the results below are as expected before I move this to Done.

OS: macOS 13.2
Browsers: Safari 16.3, Chrome 111, Firefox 111
Environment: Local

API Request Response

UserAPI Options
Temp User
T332414_IPMasking_APIOptions_TempUser.png (691ร—3 px, 210 KB)
Not Logged In
T332414_IPMasking_APIOptions_NotLoggedIn.png (603ร—3 px, 195 KB)
Admin
T332414_IPMasking_APIOptions_Admin.png (571ร—3 px, 169 KB)

API Sandbox Auto-fill token- I just wanted to check that when you are not logged in, that auto-fill the token would only input "+\" compared to the rest getting numbers

T332414_IPMasking_APIOptions_TempUser_Token.png (993ร—2 px, 236 KB)
T332414_IPMasking_APIOptions_NotLoggedIn_Token.png (1ร—3 px, 250 KB)

@GMikesell-WMF , lgtm.Thanks!

It should do the same for temporary users.

Why?

I think for T336713, it would be much better if ApiOptions just worked for temporary users. Also for ULS per T330815#8782858. I don't understand what problem we're solving by denying API options for temporary users.

Summarising a conversation that happened on Slack about this while I was out, for the sake of anyone reading this task who can't read that conversation. (All these points were made, not necessarily in this order):

  • The MVP ask was for temporary users to be treated like anon users when it comes to preferences (subject to rethinking later, as is every MVP decision)
  • A simple way of doing this is to give them exactly the same experience as anon users (i.e. prevent storing preferences in user_properties), rather than inventing a third tier of access to preferences
  • Doing this means that temp users will experience some of the same bugs that anon users experience (e.g. T336713)
  • user_properties bloat is a performance concern, but there are ways around this as discussed on T54777, that could allow certain preferences to be saved for temp users
  • Efforts are also underway to store some preferences in local storage, which may be an alternative solution

My thoughts are that, given the MVP ask for temporary users to be on a par with anonymous users, it's OK for them to experience the same bugs to begin with, especially since it seems there are some questions to be resolved here (do we implement T54777#7724456? how far can we use solutions like T336713#9030125?). However, I agree that the end-goal is to take advantages of the improvements we are now able to make over the current anon user experience.