Update bugs only with active Gerrit accounts
When determining the LP assignee for a bug, constrain the Gerrit DB query to only active accounts. Otherwise an incorrect OpenId for a defunct account may be selected instead of the intended one. Change-Id: I34e64362dd89c1d678a1f641244274fe27b5bdca
This commit is contained in:
parent
3da5fcba0a
commit
63f0ba5115
|
@ -107,12 +107,18 @@ def set_in_progress(bugtask, launchpad, uploader, change_url):
|
|||
# ...thus we need a join on a secondary query to search against
|
||||
# all the user's configured E-mail addresses.
|
||||
#
|
||||
# Worse, we also need to filter by active accounts only since
|
||||
# picking an inactive account could result in using the wrong
|
||||
# OpenId entirely.
|
||||
#
|
||||
query = """SELECT t.external_id FROM account_external_ids t
|
||||
INNER JOIN (
|
||||
SELECT t.account_id FROM account_external_ids t
|
||||
WHERE t.email_address = %s )
|
||||
original ON t.account_id = original.account_id
|
||||
AND t.external_id LIKE 'https://login.ubuntu.com%%'"""
|
||||
AND t.external_id LIKE 'https://login.ubuntu.com%%'
|
||||
JOIN accounts a ON a.account_id = t.account_id
|
||||
WHERE a.inactive = 'N'"""
|
||||
|
||||
cursor = jeepyb.gerritdb.connect().cursor()
|
||||
cursor.execute(query, searchkey)
|
||||
|
|
Loading…
Reference in New Issue