From c7ff97a6a86c2dd315d09656af568a108ada3567 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 8 Jun 2015 21:52:59 +0200 Subject: git-update: Avoid duplicate notifications Fixes FS#45254. Signed-off-by: Lukas Fleischer --- git-interface/git-update.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git-interface/git-update.py b/git-interface/git-update.py index 215848e0..958fa7a3 100755 --- a/git-interface/git-update.py +++ b/git-interface/git-update.py @@ -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() -- cgit v1.2.3-24-g4f1b