Joe (erebrandir) wrote in lj_dev,
Joe
erebrandir
lj_dev

Patch: Include support request category in request notification e-mail

Abstract

This patch makes changes to the format of support request notification e-mails, to include information about the support category of the new support request, and information on how to unsubscribe from the support request notification system.

Description

The support request notification e-mails that are sent to support volunteers currently do not include information about the support category in which a request was submitted. This information would be useful to volunteers, especially to those that subscribe to notifications from multiple support categories.

This patch would change the format of support request notification e-mails to the following:

A LiveJournal support request has been submitted regarding the following:

Category: General/Unknown
Subject: PLZ HELP URGENT!!!!!!!!!!

You can track its progress or add information here:

http://www.livejournal.com/support/see_request.bml?id=XXXXX

If you do not wish to receive notifications of incoming support requests, you may change your notification settings here:

http://www.livejournal.com/support/changenotify.bml

======================================================================

I NEED A CODE

There have been a rash of support requests recently from one-time, inactive, or infrequent support volunteers, wishing not to receive support request notification e-mails. These changes would hopefully reduce the occurrence of support requests regarding this.

This patch also changes a few hard-coded instances of "LiveJournal" to "$LJ::SITENAME" (hope that's okay).

Patch

livejournal/cgi-bin/supportlib.pl.122.diff (Tested)

Sidenote

While working on this patch, I ran across some code that didn't make sense to me. Rather than mess with it without understanding it, I thought I would point it out, and ask some questions.

[From cgi-bin/supportlib.pl (my version)]

########## send notifications

$sth = $dbh->prepare("SELECT u.email FROM supportnotify sn, user u WHERE sn.userid=u.userid AND sn.spcatid=$qspcatid AND sn.level IN ('new', 'all')");
$sth->execute;
my @to_notify;
while ($_ = $sth->fetchrow_hashref) {
    push @to_notify, $_->{'email'};
}
$body = "A $LJ::SITENAME support request has been submitted regarding the following:\n\n";
$body .= "Category: $scat->{'catname'}\n";
$body .= "Subject: $o->{'subject'}\n\n";
$body .= "You can track its progress or add information here:\n\n";
$body .= LJ::make_text_link($url, $_->{'email'});
$body .= "If you do not wish to receive notifications of incoming support requests, you may change your notification settings here:\n\n";
$body .= LJ::make_text_link("$LJ::SITEROOT/support/changenotify.bml", $_->{'email'});
$body .= "\n\n" . "="x70 . "\n\n";
$body .= $o->{'body'};

LJ::send_mail({
    'bcc' => join(", ", @to_notify),
    'from' => $LJ::BOGUS_EMAIL,
    'fromname' => "$LJ::SITENAME Support",
    'subject' => "Support Request \#$spid",
    'body' => $body
    });

return $spid;

In the code highlighted in cyan, what is $_ set to? The only place I can find where $_ is set is the code highlighted in yellow. In the instances marked by cyan, wouldn't $_ be the last value of $_ set by the yellow code? If so, is this really accomplishing anything? ($_->{'email'} is supposed to be the e-mail address of the recipient of the notification e-mail, to be used by LJ::make_text_link() to determine if the user is on AOL.)

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 10 comments