On Sat, Apr 20, 2013 at 10:50:09AM -0700, Anatol Pomozov wrote:
> Signed-off-by: Anatol Pomozov <[email protected]>
> ---
>  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: [email protected]\nFrom: 
> [email protected]\nX-Mailer: AUR\n";
> -             @mail('undisclosed-recipients: ;', "AUR Comment for " . 
> $row['Name'], $body, $headers);
> +             $headers = "Reply-to: [email protected]\nFrom: 
> [email protected]\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: 
> [email protected]\nFrom: [email protected]\nX-Mailer: AUR\n";
> -                     @mail('undisclosed-recipients: ;', "AUR Package 
> deleted: " . $pkgname, $body, $headers);
> +                     $headers = "Reply-to: [email protected]\nFrom: 
> [email protected]\nX-Mailer: AUR\n";
> +                     foreach ($recipients as $to) {
> +                             @mail($to, "AUR Package deleted: " . $pkgname, 
> $body, $headers);
> +                     }
>               }
>       }
>  
> -- 
> 1.8.2.1

Reply via email to