summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-02-21 19:44:38 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-02-21 20:01:13 +0100
commit6ec4a3589e327ded693ab0c741828fc5ec66b840 (patch)
treebe01ad41fa61a44a43010f3fbd5249c606bd70df /web
parentc23914fc1df309a6b1d85ec5387cfbef2161e655 (diff)
downloadaur-6ec4a3589e327ded693ab0c741828fc5ec66b840.tar.gz
aur-6ec4a3589e327ded693ab0c741828fc5ec66b840.tar.xz
Send notifications when changing ownership
Add a new option that makes it possible to subscribe to package ownership changes (adoption/disownment). Fixes FS#15412. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/lib/acctfuncs.inc.php7
-rw-r--r--web/lib/pkgbasefuncs.inc.php8
-rw-r--r--web/template/account_edit_form.php4
3 files changed, 16 insertions, 3 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index b39420fe..be0981f2 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -58,13 +58,14 @@ function html_format_pgp_fingerprint($fingerprint) {
* @param string $J The inactivity status of the displayed user
* @param string $CN Whether to notify of new comments
* @param string $UN Whether to notify of package updates
+ * @param string $ON Whether to notify of ownership changes
* @param string $UID The user ID of the displayed user
* @param string $N The username as present in the database
*
* @return void
*/
function display_account_form($A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",$R="",
- $L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$UID=0,$N="") {
+ $L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$ON="",$UID=0,$N="") {
global $SUPPORTED_LANGS;
include("account_edit_form.php");
@@ -92,13 +93,14 @@ function display_account_form($A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",$R=""
* @param string $J The inactivity status of the user
* @param string $CN Whether to notify of new comments
* @param string $UN Whether to notify of package updates
+ * @param string $ON Whether to notify of ownership changes
* @param string $UID The user ID of the modified account
* @param string $N The username as present in the database
*
* @return array Boolean indicating success and message to be printed
*/
function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C="",
- $R="",$L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$UID=0,$N="") {
+ $R="",$L="",$I="",$K="",$PK="",$J="",$CN="",$UN="",$ON="",$UID=0,$N="") {
global $SUPPORTED_LANGS;
$error = '';
@@ -347,6 +349,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C=""
$q.= ", InactivityTS = " . $inactivity_ts;
$q.= ", CommentNotify = " . ($CN ? "1" : "0");
$q.= ", UpdateNotify = " . ($UN ? "1" : "0");
+ $q.= ", OwnershipNotify = " . ($ON ? "1" : "0");
$q.= " WHERE ID = ".intval($UID);
$result = $dbh->exec($q);
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 1691bff7..5d10cce5 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -661,6 +661,9 @@ function pkgbase_adopt ($base_ids, $action=true, $via) {
$q.= "SET MaintainerUID = $uid ";
$q.= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
$dbh->exec($q);
+
+ /* Add the new maintainer to the notification list. */
+ pkgbase_notify($base_ids);
} else {
/* Update the co-maintainer list when disowning a package. */
if (has_credential(CRED_PKGBASE_DISOWN)) {
@@ -692,8 +695,11 @@ function pkgbase_adopt ($base_ids, $action=true, $via) {
}
}
+ foreach ($base_ids as $base_id) {
+ notify(array($action ? 'adopt' : 'disown', $base_id, $uid));
+ }
+
if ($action) {
- pkgbase_notify($base_ids);
return array(true, __("The selected packages have been adopted."));
} else {
return array(true, __("The selected packages have been disowned."));
diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php
index b9affd64..b4f01926 100644
--- a/web/template/account_edit_form.php
+++ b/web/template/account_edit_form.php
@@ -143,6 +143,10 @@
<label for="id_updatenotify"><?= __("Notify of package updates") ?>:</label>
<input type="checkbox" name="UN" id="id_updatenotify" <?= $UN ? 'checked="checked"' : '' ?> />
</p>
+ <p>
+ <label for="id_ownershipnotify"><?= __("Notify of ownership changes") ?>:</label>
+ <input type="checkbox" name="ON" id="id_ownershipnotify" <?= $ON ? 'checked="checked"' : '' ?> />
+ </p>
</fieldset>
<fieldset>