Store the email in lower case and do the comparison in lower case as well

While keeping a recording of the case-sensitivity set by the user.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2020-01-12 21:22:19 +01:00 committed by Nils Philippsen
parent 2e58bc1f96
commit 3ed514eaa1

View file

@ -327,11 +327,13 @@ class BugzillaProxy:
'''
# Turn the cclist into something usable by bugzilla
initial_cc_emails = []
initial_cc_emails_lower = []
initial_cc_fasnames = []
for watcher in cclist:
bz_email = self._get_bugzilla_email(watcher)
if bz_email:
initial_cc_emails.append(bz_email.lower())
initial_cc_emails.append(bz_email)
initial_cc_emails_lower.append(bz_email.lower())
initial_cc_fasnames.append(watcher)
else:
self.errors.append(
@ -345,8 +347,9 @@ class BugzillaProxy:
# Add owner to the cclist so comaintainers taking over a bug don't
# have to do this manually
owner_email = self._get_bugzilla_email(owner)
if owner_email not in initial_cc_emails:
initial_cc_emails.append(owner_email.lower())
if owner_email.lower() not in initial_cc_emails_lower:
initial_cc_emails.append(owner_email)
initial_cc_emails_lower.append(owner_email.lower())
initial_cc_fasnames.append(owner)
# Lookup product
@ -390,7 +393,7 @@ class BugzillaProxy:
data['initialcclist'] = initial_cc_emails
else:
for cc_member in product[pkg_key]['initialcclist']:
if cc_member.lower() not in initial_cc_emails:
if cc_member.lower() not in initial_cc_emails_lower:
data['initialcclist'] = initial_cc_emails
break