mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Transfer notifications when merging packages
When a package base is merged into another one, followers of the old package base usually want to be notified about comments the new package base as well. Fixes FS#27687. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
f9476c1093
commit
34e7f7084a
2 changed files with 17 additions and 4 deletions
|
@ -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 ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue