diff options
-rwxr-xr-x | scripts/notify.py | 7 | ||||
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/scripts/notify.py b/scripts/notify.py index 55b29110..f6bf6ffb 100755 --- a/scripts/notify.py +++ b/scripts/notify.py @@ -167,10 +167,9 @@ def delete(cur, uid, old_pkgbase_id, new_pkgbase_id=None): if new_pkgbase_id: new_pkgbase_uri = aur_location + '/pkgbase/' + new_pkgbase + '/' body = '%s [1] merged %s [2] into %s [3].\n\n' \ - 'You will no longer receive notifications about this ' \ - 'package, please go to [3] and click "%s" if you wish to ' \ - 'receive them again.' % \ - (user, old_pkgbase, new_pkgbase, 'Notify of new comments') + 'If you no longer wish receive notifications about the new ' \ + 'package, please go to [3] and click "%s".' %\ + (user, old_pkgbase, new_pkgbase, 'Disable notifications') body += '\n\n' body += '[1] ' + user_uri + '\n' body += '[2] ' + pkgbase_uri + '\n' diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 799f1da9..cb756f61 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -448,6 +448,20 @@ function pkgbase_delete ($base_ids, $merge_base_id, $via, $grant=false) { $q.= "WHERE PackageBaseID IN (" . implode(",", $base_ids) . ")"; $dbh->exec($q); + /* Merge notifications */ + $q = "SELECT DISTINCT UserID FROM CommentNotify cn "; + $q.= "WHERE PackageBaseID IN (" . implode(",", $base_ids) . ") "; + $q.= "AND NOT EXISTS (SELECT * FROM CommentNotify cn2 "; + $q.= "WHERE cn2.PackageBaseID = " . intval($merge_base_id) . " "; + $q.= "AND cn2.UserID = cn.UserID)"; + $result = $dbh->query($q); + + while ($notify_uid = $result->fetch(PDO::FETCH_COLUMN, 0)) { + $q = "INSERT INTO CommentNotify (UserID, PackageBaseID) "; + $q.= "VALUES (" . intval($notify_uid) . ", " . intval($merge_base_id) . ")"; + $dbh->exec($q); + } + /* Merge votes */ foreach ($base_ids as $base_id) { $q = "UPDATE PackageVotes "; |