From: Don Armstrong Date: Fri, 15 Mar 2013 23:29:45 +0000 (-0700) Subject: add disable avatars support X-Git-Tag: release/2.6.0~298 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=507e7fb021c286bcb59d961f9f25c89410d451a2 add disable avatars support --- diff --git a/Debbugs/CGI/Bugreport.pm b/Debbugs/CGI/Bugreport.pm index d4800cd..b3f4ec6 100644 --- a/Debbugs/CGI/Bugreport.pm +++ b/Debbugs/CGI/Bugreport.pm @@ -113,6 +113,9 @@ sub display_entity { trim_headers => {type => BOOLEAN, default => 1, }, + avatars => {type => BOOLEAN, + default => 1, + }, } ); @@ -142,7 +145,7 @@ sub display_entity { my $head_field = $head->get($_); next unless defined $head_field and $head_field ne ''; chomp $head_field; - if ($_ eq 'From') { + if ($_ eq 'From' and $param{avatars}) { my $libravatar_url = __libravatar_url(decode_rfc1522($head_field)); if (defined $libravatar_url and length $libravatar_url) { push @headers,q(\n); @@ -221,6 +224,7 @@ sub display_entity { terse => $param{terse}, exists $param{msg}?(msg=>$param{msg}):(), exists $param{att}?(att=>$param{att}):(), + exists $param{avatars}?(avatars=>$param{avatars}):(), ); # print {$output} "\n"; } @@ -240,6 +244,7 @@ sub display_entity { terse => $param{terse}, exists $param{msg}?(msg=>$param{msg}):(), exists $param{att}?(att=>$param{att}):(), + exists $param{avatars}?(avatars=>$param{avatars}):(), ); # print {$output} "\n"; } @@ -319,6 +324,7 @@ sub handle_email_message{ exists $param{msg}?(msg=>$param{msg}):(), exists $param{att}?(att=>$param{att}):(), exists $param{trim_headers}?(trim_headers=>$param{trim_headers}):(), + exists $param{avatars}?(avatars=>$param{avatars}):(), ); return decode_utf8($output); } @@ -334,7 +340,7 @@ should be output to the browser. =cut sub handle_record{ - my ($record,$bug_number,$msg_number,$seen_msg_ids) = @_; + my ($record,$bug_number,$msg_number,$seen_msg_ids,%param) = @_; # output needs to have the is_utf8 flag on to avoid double # encoding @@ -397,6 +403,7 @@ sub handle_record{ $output .= handle_email_message($record->{text}, ref => $bug_number, msg_num => $msg_number, + %param, ); } elsif (/autocheck/) { @@ -424,6 +431,7 @@ sub handle_record{ $output .= handle_email_message($record->{text}, ref => $bug_number, msg_num => $msg_number, + %param, ); } else { diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 70f4229..3899a9d 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -43,7 +43,7 @@ my %param = cgi_parameters(query => $q, single => [qw(bug msg att boring terse), qw(reverse mbox mime trim), qw(mboxstat mboxmaint archive), - qw(repeatmerged) + qw(repeatmerged avatars), ], default => {# msg => '', boring => 'no', @@ -55,6 +55,7 @@ my %param = cgi_parameters(query => $q, mboxmaint => 'no', archive => 'no', repeatmerged => 'yes', + avatars => 'yes', }, ); # This is craptacular. @@ -70,6 +71,7 @@ my $terse = $param{'terse'} eq 'yes'; my $reverse = $param{'reverse'} eq 'yes'; my $mbox = $param{'mbox'} eq 'yes'; my $mime = $param{'mime'} eq 'yes'; +my $avatars = $param{avatars} eq 'yes'; my %bugusertags; my %ut; @@ -265,7 +267,11 @@ else { next; } $skip_next = 1 if $record->{type} eq 'html' and not $boring; - push @log, handle_record($record,$ref,$msg_num,\%seen_msg_ids); + push @log, handle_record($record,$ref,$msg_num, + \%seen_msg_ids, + trim_headers => $trim_headers, + avatars => $avatars, + ); } }