[aur-dev] [PATCH] FS#34843: Send AUR notifications directly to user to make it more visible

Lukas Fleischer archlinux at cryptocrack.de
Wed Apr 24 05:05:36 EDT 2013


On Sat, Apr 20, 2013 at 10:50:09AM -0700, Anatol Pomozov wrote:
> Signed-off-by: Anatol Pomozov <anatol.pomozov at gmail.com>
> ---
>  web/lib/pkgfuncs.inc.php | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 

First off, I would like to have seen a rationale in the commit message.
What does "to make it more visible" mean?

Also, canyonknight is working on a complete rewrite of the notification
system.

canyonknight: Any comments on this one?

> diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
> index 53b7e54..ee150ca 100644
> --- a/web/lib/pkgfuncs.inc.php
> +++ b/web/lib/pkgfuncs.inc.php
> @@ -260,11 +260,11 @@ function add_package_comment($pkgid, $uid, $comment) {
>  	$q.= "AND CommentNotify.UserID != " . $uid . " ";
>  	$q.= "AND CommentNotify.PkgID = " . intval($pkgid);
>  	$result = $dbh->query($q);
> -	$bcc = array();
> +	$recipients = array();
>  
>  	if ($result) {
>  		while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
> -			array_push($bcc, $row['Email']);
> +			array_push($recipients, $row['Email']);
>  		}
>  
>  		$q = "SELECT Packages.* ";
> @@ -282,9 +282,10 @@ function add_package_comment($pkgid, $uid, $comment) {
>  		. $comment
>  		. "\n\n---\nIf you no longer wish to receive notifications about this package, please go the the above package page and click the UnNotify button.";
>  		$body = wordwrap($body, 70);
> -		$bcc = implode(', ', $bcc);
> -		$headers = "Bcc: $bcc\nReply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> -		@mail('undisclosed-recipients: ;', "AUR Comment for " . $row['Name'], $body, $headers);
> +		$headers = "Reply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> +		foreach ($recipients as $to) {
> +			@mail($to, "AUR Comment for " . $row['Name'], $body, $headers);
> +		}
>  	}
>  }
>  
> @@ -873,12 +874,12 @@ function pkg_delete ($atype, $ids, $mergepkgid) {
>  		$q.= "AND CommentNotify.UserID != " . uid_from_sid($_COOKIE['AURSID']) . " ";
>  		$q.= "AND CommentNotify.PkgID = " . $pkgid;
>  		$result = $dbh->query($q);
> -		$bcc = array();
> +		$recipients = array();
>  
>  		while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
> -			array_push($bcc, $row['Email']);
> +			array_push($recipients, $row['Email']);
>  		}
> -		if (!empty($bcc)) {
> +		if (!empty($recipients)) {
>  			$pkgname = pkgname_from_id($pkgid);
>  
>  			# TODO: native language emails for users, based on their prefs
> @@ -893,9 +894,10 @@ function pkg_delete ($atype, $ids, $mergepkgid) {
>  				$body .= "You will no longer receive notifications about this package.";
>  			}
>  			$body = wordwrap($body, 70);
> -			$bcc = implode(', ', $bcc);
> -			$headers = "Bcc: $bcc\nReply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> -			@mail('undisclosed-recipients: ;', "AUR Package deleted: " . $pkgname, $body, $headers);
> +			$headers = "Reply-to: nobody at archlinux.org\nFrom: aur-notify at archlinux.org\nX-Mailer: AUR\n";
> +			foreach ($recipients as $to) {
> +				@mail($to, "AUR Package deleted: " . $pkgname, $body, $headers);
> +			}
>  		}
>  	}
>  
> -- 
> 1.8.2.1


More information about the aur-dev mailing list