git-update: Avoid duplicate notifications

Fixes FS#45254.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-06-08 21:52:59 +02:00
parent 8aa4c51dfb
commit c7ff97a6a8

View file

@ -144,6 +144,10 @@ def save_srcinfo(srcinfo, db, cur, user):
# Add user to notification list on adoption. # Add user to notification list on adoption.
if was_orphan: if was_orphan:
cur.execute("SELECT COUNT(*) FROM CommentNotify WHERE " +
"PackageBaseID = %s AND UserID = %s",
[pkgbase_id, user_id])
if cur.fetchone()[0] == 0:
cur.execute("INSERT INTO CommentNotify (PackageBaseID, UserID) " + cur.execute("INSERT INTO CommentNotify (PackageBaseID, UserID) " +
"VALUES (%s, %s)", [pkgbase_id, user_id]) "VALUES (%s, %s)", [pkgbase_id, user_id])