Committer: azateev
LJSV-2568: Implement SupportRequest eventU branches/esn-support/cgi-bin/supportlib.pl
Modified: branches/esn-support/cgi-bin/supportlib.pl =================================================================== --- branches/esn-support/cgi-bin/supportlib.pl 2013-01-14 14:51:37 UTC (rev 23537) +++ branches/esn-support/cgi-bin/supportlib.pl 2013-01-14 14:53:17 UTC (rev 23538) @@ -637,91 +637,8 @@ LJ::ContentFlag->set_supportid($o->{flagid}, $spid); } -my $miniauth = mini_auth({ 'authcode' => $authcode }); - $url = "$LJ::SITEROOT/support/see_request.bml?id=$spid"; - $urlauth = "$url&auth=$miniauth"; - $closeurl = "$LJ::SITEROOT/support/act.bml?close;$spid;$authcode"; + LJ::Event::SupportRequest->new($u, $spid)->fire; - # disable auto-replies for the entire category, or per request - if (! $scat->{'no_autoreply'} && ! $o->{'no_autoreply'}) { - - my $closeable = sub { - return "" unless $scat->{user_closeable}; - my $text = LJ::Lang::get_text ( - $lang, - 'notification.support.submit.request.closeable', - undef, - { closeurl => $closeurl } - ); - if ($html) { - $text =~ s/\n/<br \/>/g; - } - return $text; - }; - - my $requester = LJ::Lang::get_text ($lang,'notification.support.requester'); - my $subject = LJ::Lang::get_text ( - $lang, - 'notification.support.submit.request.subject', - undef, - { request_id => $spid } - ); - my $body = LJ::Lang::get_text ( - $lang, - 'notification.support.submit.request.body.plain', - undef, - { - username => $username || - $o->{'reqname'} || - $requester, - subject => $o->{'subject'}, - request_id => $spid, - urlauth => $urlauth, - close_it => $closeable->(), - sitename => $LJ::SITENAMESHORT, - siteroot => $LJ::SITEROOT, - } - ); - if ($html) { - my $html_body = LJ::Lang::get_text ( - $lang, - 'notification.support.submit.request.body.html', - undef, - { - username => $ljuser || - $o->{'reqname'} || - $requester, - subject => $o->{'subject'}, - request_id => $spid, - urlauth => $urlauth, - close_it => $closeable->(), - sitename => $LJ::SITENAMESHORT, - siteroot => $LJ::SITEROOT, - } - ); - LJ::send_mail({ - to => $email, - from => $LJ::BOGUS_EMAIL, - fromname => "$LJ::SITENAME Support", - charset => 'utf-8', - subject => $subject, - body => $body, - html => $html_body, - }); - } else { - LJ::send_mail({ - to => $email, - from => $LJ::BOGUS_EMAIL, - fromname => "$LJ::SITENAME Support", - charset => 'utf-8', - subject => $subject, - body => $body, - }); - } - } - - support_notify({ spid => $spid, type => 'new' }); - # and we're done return $spid; }