python-mapswipe-workers
python-mapswipe-workers copied to clipboard
American Red Cross user group has a user in the member list with no profile name
there are users that show up in user groups without names.
@Hagellach37: this is a user who signed up with an OpenStreetMap account. for these users we get the username from OSM. but maybe we need to check how we store the OSM username.
@thenav56:
I poked around and looks like for the osm user have this attribute displayName
in the firebase which the python-worker doesn't store or use. Quick fix will be to use the user_id
if username is empty or not provided. And decide is we can use displayName
for username and sync all existing users as well. For now, should we go for the quick fix?
@Hagellach37:
probable we don't set it properly for the users that log in with their osm account
basically we need to set it twice:
firebase authentication --> displayName
firebase realtime database --> username
can you confirm this @laurentS?
@laurentS:
yes, correct, firebase uses 2 different names as Benni mentioned above. When a users signs up with email/password, we copy their chosen username to both places (auth.displayName
and db.username
) but it looks like for OSM logins (it is difficult to know if the user had signed in with OSM before or not), we copy their displayName but maybe not their username https://github.com/mapswipe/python-mapswipe-workers/blob/master/firebase/functions/src/osm_auth.ts#L230
@laurentS: you'd have to confirm this, but I suspect you may not have access to displayName if not authenticated as the user. If so, I'll have to figure out where to copy it to username so that you have access to it. It seems like an auth issue more than a problem with your stats
@danbjoseph: this is on the open, community dashboard pages so the viewer will never be authenticated
@laurentS: ok, I've added this to my todo list :)
@Hagellach37:
another insight about this. For users with OSM login we set the name as displayName
in firebase database, but for users that sign up via email we set the name as username
.
E.g. see here the differences:
{
"created": "2023-01-24T12:25:48.677Z",
"displayName": "nassanga",
"groupContributionCount": 28,
"lastAppUse": "2023-02-02T17:24:28.142Z",
"projectContributionCount": 5,
"taskContributionCount": 1465
}
{
"created": "2020-10-15T19:12:27.532Z",
"groupContributionCount": 2,
"lastAppUse": "2022-01-07T16:11:15.568Z",
"projectContributionCount": 2,
"taskContributionCount": 322,
"teamId": "-MekUI0PHI2M1AGavW0j",
"username": "Benni Bamako"
}
I think this is what @thenav56 also said, but I didn't get it right in the first place. Good catch