summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL3
-rw-r--r--doc/git-interface.txt8
-rw-r--r--schema/aur-schema.sql2
-rwxr-xr-xscripts/notify.py44
-rw-r--r--upgrading/4.3.0.txt11
-rw-r--r--web/html/css/aurweb.css5
-rw-r--r--web/html/index.php4
-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
-rw-r--r--web/template/pkgbase_actions.php2
11 files changed, 84 insertions, 14 deletions
diff --git a/INSTALL b/INSTALL
index be39052..8b0cd29 100644
--- a/INSTALL
+++ b/INSTALL
@@ -47,7 +47,8 @@ Setup on Arch Linux
# cd /srv/http/aurweb/aur.git/
# git init --bare
# git config --local transfer.hideRefs '^refs/'
- # git config --local transfer.hideRefs '!refs/'
+ # git config --local --add transfer.hideRefs '!refs/'
+ # git config --local --add transfer.hideRefs '!HEAD'
# ln -s ../../git-interface/git-update.py hooks/update
# chown -R aur .
diff --git a/doc/git-interface.txt b/doc/git-interface.txt
index 4a24eef..69c558b 100644
--- a/doc/git-interface.txt
+++ b/doc/git-interface.txt
@@ -89,7 +89,7 @@ so-called "have" lines. This is normally used to reduce traffic but it has the
opposite effect in the case of aurweb: Many essentially useless lines are
transferred to the Git client during `git push` operations.
-In order to omit these advertisements, add the strings "^refs/" and "!refs/" to
-the transfer.hideRefs configuration setting. Note that the order of these
-patterns is important ("^refs/" must come first) and that Git 2.7 or newer is
-required for them to work.
+In order to omit these advertisements, add the strings "^refs/", "!refs/" and
+"!HEAD" to the transfer.hideRefs configuration setting. Note that the order of
+these patterns is important ("^refs/" must come first) and that Git 2.7 or
+newer is required for them to work.
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index aa5ed9d..0804ac3 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -35,7 +35,7 @@ CREATE TABLE Users (
IRCNick VARCHAR(32) NOT NULL DEFAULT '',
PGPKey VARCHAR(40) NULL DEFAULT NULL,
LastLogin BIGINT UNSIGNED NOT NULL DEFAULT 0,
- LastLoginIPAddress VARCHAR(40) NULL DEFAULT NULL,
+ LastLoginIPAddress VARCHAR(45) NULL DEFAULT NULL,
InactivityTS BIGINT UNSIGNED NOT NULL DEFAULT 0,
RegistrationTS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CommentNotify TINYINT(1) NOT NULL DEFAULT 1,
diff --git a/scripts/notify.py b/scripts/notify.py
index 25102a2..5e5f377 100755
--- a/scripts/notify.py
+++ b/scripts/notify.py
@@ -115,6 +115,16 @@ def get_update_recipients(cur, pkgbase_id, uid):
return [row[0] for row in cur.fetchall()]
+def get_ownership_recipients(cur, pkgbase_id, uid):
+ cur.execute('SELECT DISTINCT Users.Email FROM Users ' +
+ 'INNER JOIN PackageNotifications ' +
+ 'ON PackageNotifications.UserID = Users.ID WHERE ' +
+ 'Users.OwnershipNotify = 1 AND ' +
+ 'PackageNotifications.UserID != %s AND ' +
+ 'PackageNotifications.PackageBaseID = %s', [uid, pkgbase_id])
+ return [row[0] for row in cur.fetchall()]
+
+
def get_request_recipients(cur, reqid):
cur.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' +
@@ -243,6 +253,38 @@ def flag(cur, uid, pkgbase_id):
send_notification(to, subject, body, refs)
+def adopt(cur, pkgbase_id, uid):
+ user = username_from_id(cur, uid)
+ pkgbase = pkgbase_from_id(cur, pkgbase_id)
+ to = get_ownership_recipients(cur, pkgbase_id, uid)
+
+ user_uri = aur_location + '/account/' + user + '/'
+ pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
+
+ subject = 'AUR Ownership Notification for %s' % (pkgbase)
+ body = 'The package %s [1] was adopted by %s [2].' % (pkgbase, user)
+ refs = '[1] ' + pkgbase_uri + '\n'
+ refs += '[2] ' + user_uri
+
+ send_notification(to, subject, body, refs)
+
+
+def disown(cur, pkgbase_id, uid):
+ user = username_from_id(cur, uid)
+ pkgbase = pkgbase_from_id(cur, pkgbase_id)
+ to = get_ownership_recipients(cur, pkgbase_id, uid)
+
+ user_uri = aur_location + '/account/' + user + '/'
+ pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
+
+ subject = 'AUR Ownership Notification for %s' % (pkgbase)
+ body = 'The package %s [1] was disowned by %s [2].' % (pkgbase, user)
+ refs = '[1] ' + pkgbase_uri + '\n'
+ refs += '[2] ' + user_uri
+
+ send_notification(to, subject, body, refs)
+
+
def comaintainer_add(cur, pkgbase_id, uid):
pkgbase = pkgbase_from_id(cur, pkgbase_id)
to = [get_user_email(cur, uid)]
@@ -364,6 +406,8 @@ if __name__ == '__main__':
'comment': comment,
'update': update,
'flag': flag,
+ 'adopt': adopt,
+ 'disown': disown,
'comaintainer-add': comaintainer_add,
'comaintainer-remove': comaintainer_remove,
'delete': delete,
diff --git a/upgrading/4.3.0.txt b/upgrading/4.3.0.txt
new file mode 100644
index 0000000..34b19a2
--- /dev/null
+++ b/upgrading/4.3.0.txt
@@ -0,0 +1,11 @@
+1. Add a column to store ownership notification settings:
+
+----
+ALTER TABLE Users ADD COLUMN OwnershipNotify TINYINT(1) NOT NULL DEFAULT 1;
+----
+
+2. Resize the LastLoginIPAddress column:
+
+----
+ALTER TABLE Users MODIFY LastLoginIPAddress VARCHAR(45) NULL DEFAULT NULL;
+----
diff --git a/web/html/css/aurweb.css b/web/html/css/aurweb.css
index f5e1037..f777ab8 100644
--- a/web/html/css/aurweb.css
+++ b/web/html/css/aurweb.css
@@ -148,3 +148,8 @@ label.confirmation,
color: red;
font-weight: bold;
}
+
+#news div p {
+ max-height: 15em;
+ overflow: auto;
+}
diff --git a/web/html/index.php b/web/html/index.php
index 3787d4e..78ab6ad 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -167,10 +167,6 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
header("Content-Type: image/gif");
readfile("./$path");
break;
- case "/css/archnavbar/archlogo.gif":
- header("Content-Type: image/png");
- readfile("./$path");
- break;
case "/css/archnavbar/archlogo.png":
case "/css/archnavbar/aurlogo.png":
case "/images/favicon.ico":
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 2d70f65..0eb021e 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 1691bff..5d10cce 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 b9affd6..b4f0192 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>
diff --git a/web/template/pkgbase_actions.php b/web/template/pkgbase_actions.php
index 237e712..d3f0592 100644
--- a/web/template/pkgbase_actions.php
+++ b/web/template/pkgbase_actions.php
@@ -24,7 +24,7 @@
<?php if (pkgbase_user_notify($uid, $base_id)): ?>
<li><?= html_action_form($base_uri . 'unnotify/', "do_UnNotify", __('Disable notifications')) ?></li>
<?php else: ?>
- <li><?= html_action_form($base_uri . 'notify/', "do_Notify", __('Notify of new comments')) ?></li>
+ <li><?= html_action_form($base_uri . 'notify/', "do_Notify", __('Enable notifications')) ?></li>
<?php endif; ?>
<?php if (has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($row["MaintainerUID"]))): ?>