Fix notifications emails going to the right people

In commit f3b4c5c (Refactor the notification script, 2018-05-17), the
parameters of the adopt, disown, comaintainer-add and
comaintainer-remove notification modules were accidentally pushed around
without changing the order in the callers. The notify script now expects
to see the userid followed by additional arguments like the pkgbase id.

As a result, some random userid with the same id as the pkgbase, got
sent a notification regarding some package with the same id as the real
user's id.

Fix this by changing the order in every invocation of the aforementioned
modules.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-08-10 17:26:28 -04:00 committed by Lukas Fleischer
parent 257115943e
commit b702e5c0e7

View file

@ -107,7 +107,7 @@ def pkgbase_adopt(pkgbase, user, privileged):
[pkgbase_id, userid]) [pkgbase_id, userid])
conn.commit() conn.commit()
subprocess.Popen((notify_cmd, 'adopt', str(pkgbase_id), str(userid))) subprocess.Popen((notify_cmd, 'adopt', str(userid), str(pkgbase_id)))
conn.close() conn.close()
@ -165,8 +165,8 @@ def pkgbase_set_comaintainers(pkgbase, userlist, user, privileged):
cur = conn.execute("INSERT INTO PackageComaintainers " + cur = conn.execute("INSERT INTO PackageComaintainers " +
"(PackageBaseID, UsersID, Priority) " + "(PackageBaseID, UsersID, Priority) " +
"VALUES (?, ?, ?)", [pkgbase_id, userid, i]) "VALUES (?, ?, ?)", [pkgbase_id, userid, i])
subprocess.Popen((notify_cmd, 'comaintainer-add', str(pkgbase_id), subprocess.Popen((notify_cmd, 'comaintainer-add', str(userid),
str(userid))) str(pkgbase_id)))
else: else:
cur = conn.execute("UPDATE PackageComaintainers " + cur = conn.execute("UPDATE PackageComaintainers " +
"SET Priority = ? " + "SET Priority = ? " +
@ -179,7 +179,7 @@ def pkgbase_set_comaintainers(pkgbase, userlist, user, privileged):
"WHERE PackageBaseID = ? AND UsersID = ?", "WHERE PackageBaseID = ? AND UsersID = ?",
[pkgbase_id, userid]) [pkgbase_id, userid])
subprocess.Popen((notify_cmd, 'comaintainer-remove', subprocess.Popen((notify_cmd, 'comaintainer-remove',
str(pkgbase_id), str(userid))) str(userid), str(pkgbase_id)))
conn.commit() conn.commit()
conn.close() conn.close()
@ -266,7 +266,7 @@ def pkgbase_disown(pkgbase, user, privileged):
if userid == 0: if userid == 0:
raise aurweb.exceptions.InvalidUserException(user) raise aurweb.exceptions.InvalidUserException(user)
subprocess.Popen((notify_cmd, 'disown', str(pkgbase_id), str(userid))) subprocess.Popen((notify_cmd, 'disown', str(userid), str(pkgbase_id)))
conn.close() conn.close()