]> git.donarmstrong.com Git - debbugs.git/commitdiff
add disable avatars support
authorDon Armstrong <don@donarmstrong.com>
Fri, 15 Mar 2013 23:29:45 +0000 (16:29 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 15 Mar 2013 23:29:45 +0000 (16:29 -0700)
Debbugs/CGI/Bugreport.pm
cgi/bugreport.cgi

index d4800cd3c7df1f0440962f20c49d457eec8d491a..b3f4ec6defafd3cb7287029ba9859abbc8d72743 100644 (file)
@@ -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(<img src=").$libravatar_url.qq(">\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 {
index 70f42292644f437e1284a6ba0aee2eeb5aabb635..3899a9defe715f2486770d1285cafe01fd17cb4b 100755 (executable)
@@ -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,
+                                  );
      }
 }