Commit c7ff97a6 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

git-update: Avoid duplicate notifications



Fixes FS#45254.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 8aa4c51d
......@@ -144,8 +144,12 @@ def save_srcinfo(srcinfo, db, cur, user):
# Add user to notification list on adoption.
if was_orphan:
cur.execute("INSERT INTO CommentNotify (PackageBaseID, UserID) " +
"VALUES (%s, %s)", [pkgbase_id, user_id])
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) " +
"VALUES (%s, %s)", [pkgbase_id, user_id])
db.commit()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment