Retrieve the email field rather than the bugzilla_email one
The bugzilla_email relies on a user id -> email mapping that is kept in python-fedora fedora/client/fas2.py. That mapping is out-dated and, in fact, conflicts with the one used in this project in email_overrides.toml. So instead of retrieving the bugzilla_email, we retrieve the regular email and use our, up to date and maintained mapping to do the overrides. Otherwise, we end up in the situation described at: https://pagure.io/fesco/issue/2460#comment-669474 where user A was marked as having an invalid account because they had a bugzilla_email entry that was returning an invalid bugzilla account. Changing to use the email field led to more people having invalid accounts because their mapping had not been updated. So let's make sure that mapping remains up to date now and use only one. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
e9cc33ff09
commit
5088abf327
1 changed files with 5 additions and 5 deletions
|
@ -145,7 +145,7 @@ class BugzillaProxy:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.user_cache = self.fas.people_by_key(
|
self.user_cache = self.fas.people_by_key(
|
||||||
key="username", fields=["bugzilla_email"]
|
key="username", fields=["email"]
|
||||||
)
|
)
|
||||||
except fedora.client.ServerError:
|
except fedora.client.ServerError:
|
||||||
# Sometimes, building the user cache up front fails with a timeout.
|
# Sometimes, building the user cache up front fails with a timeout.
|
||||||
|
@ -238,20 +238,20 @@ class BugzillaProxy:
|
||||||
reloads the cache from fas and tries again.
|
reloads the cache from fas and tries again.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
bz_email = self.user_cache[username]["bugzilla_email"].lower()
|
bz_email = self.user_cache[username]["email"].lower()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if username.startswith("@"):
|
if username.startswith("@"):
|
||||||
group = self.fas.group_by_name(username[1:])
|
group = self.fas.group_by_name(username[1:])
|
||||||
bz_email = group.mailing_list
|
bz_email = group.mailing_list
|
||||||
if bz_email is None:
|
if bz_email is None:
|
||||||
return
|
return
|
||||||
self.user_cache[username] = {"bugzilla_email": bz_email}
|
self.user_cache[username] = {"email": bz_email}
|
||||||
else:
|
else:
|
||||||
person = self.fas.person_by_username(username)
|
person = self.fas.person_by_username(username)
|
||||||
bz_email = person.get("bugzilla_email", None)
|
bz_email = person.get("email")
|
||||||
if bz_email is None:
|
if bz_email is None:
|
||||||
return
|
return
|
||||||
self.user_cache[username] = {"bugzilla_email": bz_email}
|
self.user_cache[username] = {"email": bz_email}
|
||||||
bz_email = bz_email.lower()
|
bz_email = bz_email.lower()
|
||||||
self.inverted_user_cache[bz_email] = username
|
self.inverted_user_cache[bz_email] = username
|
||||||
bz_email = email_overrides.get(bz_email, bz_email)
|
bz_email = email_overrides.get(bz_email, bz_email)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue