Page MenuHomePhabricator

Unattached users are not handled correctly
Closed, ResolvedPublic

Description

If a global user is not attached to the local wiki, CampaignsCentralUserLookup::getLocalUser() will throw an exception, and the user will not appear in several places (e.g., list of participants). I think most if not all places do not actually need the user to be attached, so we should try and avoid using getLocalUser whenever possible.

Testing notes

This task involves a large refactoring of the concept of user inside the extension, and there's no specific thing that might have broken. So I don't have specific notes, except for: make sure that everything is still functional. Anything that uses the concept of user (that is, pretty much everything) should be tested ideally; both when it's about other users (e.g. lists of participants/organizers) or the current user (e.g., permission checks). One thing that is particularly important to test is the behaviour with unattached users. To test that, you may perform some actions on a wiki (e.g., create a registration, register as a participant), then log out, go to a wiki where your account does not exist (you can use Special:CentralAuth to verify that), and see how your username appears when looking at registration details on that wiki (e.g., is your username shown at all? Also, the expected behaviour for now is that the link to your account in the "more details" dialog will be red if the account does not exist locally).

Also, as part of this task we should update the documentation of the following endpoints:

  • List events by organizer: now takes a global user ID as parameter
  • List events by participant: now takes a global user ID as parameter
  • List organizers of an event: now returns global user IDs
  • List participants of an event: now returns global user IDs

Please holler at me if those are not updated by the time this task reaches the QA column.

Event Timeline

Change 816087 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Split user and authority

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

Change 816790 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Introduce CentralUser to replace ICampaignsUser

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

@Daimona Hello! Would this be an error that someone encounters in the user flow, or how would this happen? Thanks.

@Daimona Hello! Would this be an error that someone encounters in the user flow, or how would this happen? Thanks.

It's not just an error or something in the user flow; to put it simply, our internal representation of users is wrong. Our dataset only references central users, but in the application we would often try to convert a global user to a local one, and potentially back to global again. Aside from being unnecessary, global users are not guaranteed to exist locally, which can result in various inconsistencies all over the place. The testing notes in the task description provide some examples.

Change 816087 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Split user and authority

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

Change 816790 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Introduce CentralUser to replace ICampaignsUser

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

I don't think moving this back to review was intentional.

ldelench_wmf moved this task from Backlog to Darkship on the Campaign-Registration board.
ldelench_wmf subscribed.

assuming this is for darkship; feel free to adjust if that's not correct

β€’ vyuen changed the task status from Open to In Progress.Aug 30 2022, 3:02 PM

πŸ‘ Using account on the left to check through Special:CentralAuth that user Vdubs82 does not exist in https://ar.wikipedia.beta.wmflabs.org/, but when logged out in the view on the right, the use is still correctly displaying for the event https://ar.wikipedia.beta.wmflabs.org/wiki/%D8%AE%D8%A7%D8%B5:EventDetails/120 which the user joined as a participant on https://en.wikipedia.beta.wmflabs.org/wiki/Special:EventDetails/120

Screen Shot 2022-08-30 at 2.00.59 PM.png (1Γ—3 px, 703 KB)


πŸ‘ API docs correctly updated


@Daimona For this Also, the expected behaviour for now is that the link to your account in the "more details" dialog will be red if the account does not exist locally I am not sure how to test this because if a user does not exist locally then the user can not be in the more details dialog, as namespaced events do no exist across wikis. (For example, Event:Test could be created on en wiki and a separate and unrelated Event:Test could also be created on ar wiki, with separate participants, organizers, etc). So if a user registers for Event:Test on en wiki and then you go to Event:Test on ar wiki, not only will the more details dialog containing that event not necessarily exist, but the entire event may not necessarily exist. Or maybe I am misunderstanding something here?

@Daimona For this Also, the expected behaviour for now is that the link to your account in the "more details" dialog will be red if the account does not exist locally I am not sure how to test this because if a user does not exist locally then the user can not be in the more details dialog, as namespaced events do no exist across wikis. (For example, Event:Test could be created on en wiki and a separate and unrelated Event:Test could also be created on ar wiki, with separate participants, organizers, etc). So if a user registers for Event:Test on en wiki and then you go to Event:Test on ar wiki, not only will the more details dialog containing that event not necessarily exist, but the entire event may not necessarily exist. Or maybe I am misunderstanding something here?

I guess what I meant could be tested by doing the following

  • Create an event on arwiki, with any account you want
  • Then go to enwiki and create a new account
  • Using the new account, go to Special:RegisterForEvent/123 on enwiki, where 123 is the ID of the event you just created
  • Using the first account, go to the event page (on arwiki) and open the "more details" dialog

Note, it's important that you NEVER visit arwiki with the newly-created account, because doing so will result in the account being autocreated.

Is this helpul?

Ah yes, @Daimona this is helpful.

This is functioning as expected.

Screen Recording 2022-08-30 at 4.52.04 PM.mov-F3D2EF90-A719-4C01-A4E3-096FF35F366A.gif (732Γ—720 px, 1 MB)


Another example of this functioning correctly following the steps in T313133#8200685
First registering for event with a new account:

Screen Recording 2022-08-31 at 3.54.19 PM.mov-814E8B17-4267-48EC-A33D-E1D0162DED9E.gif (388Γ—720 px, 1 MB)

User is showing as registered on new event on arabic wiki:

Screen Shot 2022-08-31 at 4.05.57 PM.png (1Γ—1 px, 130 KB)

Even though user does not have an account on arabic wiki:

Screen Shot 2022-08-31 at 4.06.24 PM.png (1Γ—1 px, 192 KB)


Also for, the expected behaviour for now is that the link to your account in the "more details" dialog will be red if the account does not exist locally. This is functioning as expected, but users that do not exist on a wiki currently display the same as users who do exist locally on that wiki, but just don't have a talk page associated with their name. It might be good to differentiate that at some point. In this example there are two participants, the first exists on the wiki but doesn't have a talk page and the second doesn't exist on the wiki at all:

Screen Shot 2022-08-31 at 4.27.06 PM.png (1Γ—1 px, 129 KB)

Ah yes, @Daimona this is helpful.

This is functioning as expected.

Nice, thank you :)

As per the tests conducted by Vaughn, I'm marking this as Done.