diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-08 21:52:59 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-08 21:52:59 +0200 |
commit | c7ff97a6a86c2dd315d09656af568a108ada3567 (patch) | |
tree | c4987b17d1e02b8180b36e121fbf8b12feb89046 | |
parent | 8aa4c51dfb0baab7204f13da23618569dc1c7162 (diff) | |
download | aurweb-c7ff97a6a86c2dd315d09656af568a108ada3567.tar.xz |
git-update: Avoid duplicate notifications
Fixes FS#45254.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-x | git-interface/git-update.py | 8 |
1 files 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() |