Committer: azateev
LJSUP-11982 Show internal suspend reason to those, who can see it in statushistoryU trunk/cgi-bin/LJ/Widget/ErrorPage.pm
Modified: trunk/cgi-bin/LJ/Widget/ErrorPage.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/ErrorPage.pm 2012-04-27 12:57:54 UTC (rev 11850) +++ trunk/cgi-bin/LJ/Widget/ErrorPage.pm 2012-04-27 13:37:09 UTC (rev 11851) @@ -134,6 +134,8 @@ my %args = @_; my $journal_username = $args{'journal_username'}; my $remote_equals_journal = $args{'remote_equals_journal'}; + my $remote = $args{'remote'}; + my $can_view_reason = LJ::check_priv($remote,'historyview','suspend'); my $ml_description = ''; if ($remote_equals_journal) { @@ -148,6 +150,27 @@ ); } + # using direct DB request because + # there are no reading methods for statushistory + if ($can_view_reason) { + my $uid = $args{'journal'} -> userid; + my $dbr = LJ::get_db_reader(); + $dbr->{'RaiseError'} = 1; + + my ($res) = $dbr->selectrow_array(qq{ + SELECT notes + FROM statushistory + WHERE shtype = 'suspend' + AND userid = $uid + ORDER BY shdate DESC + LIMIT 1 + }); + if ($res) { + $ml_description .= "<br /><br />Internal suspension reason:<br />". + LJ::Text->wrap_urls(LJ::ehtml($res)); + } + } + return { 'frank_img' => '/frank-suspend.png', 'title' => LJ::Lang::ml('.errorpage.suspended.title'),