[aur-dev] [PATCH] git-update: Avoid duplicate notifications
Fixes FS#45254. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- 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 215848e..958fa7a 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() -- 2.4.2
participants (1)
-
Lukas Fleischer