chiark / gitweb /
xlog: Optionally show more approval/rejection reasons
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Dec 2014 16:37:25 +0000 (16:37 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Dec 2014 16:39:31 +0000 (16:39 +0000)
* Include the $cathow from the decision in the approval mail
* Append it to the event in the event.log
* Make report capable of filtering the reasons shown (by showing
  only a specified number of words, defaulting to 1 for approve
  and reject, which gives the previous behaviour)

Setting -rapprove=9 would show "everything" which includes the
identity of the moderator approving.  -rapprove=2 would show just auto
vs. manual

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
webstump/scripts/filter.lib.pl
xlog/bin/record
xlog/bin/report

index 3a41cb5656d19a1a5e9cfa3f8736e9bb6db7cb41..965d816430f2b04f9b5b2707aff56df1ec3f622a 100644 (file)
@@ -25,6 +25,7 @@ sub process_approval_decision {
                "Subject: $Subject\n" .
                 "Organization: http://www.algebra.com/~ichudov/stump\n";
 
+  $message .= "\n# $cathow\n";
   $message .= "\n$decision\n";
   $message .= "comment $comment\n" if $comment;
   &email_message( $message, $address );
index 240883354825fa8ba935039ec6efb719c7bfb8de..916be1282e640c8755d4f9bb6b03fddecbb2e28a 100755 (executable)
@@ -96,10 +96,14 @@ sub parse_webstump2stump () {
        parse__stumpsubject();
        last if m/^$/;
     }
+    my $cathow = '';
     while (<STDIN>) {
        chomp;
+       if (m/^\#( \w+.*)$/) {
+           $cathow = $1;
+       }
        next unless m/^reject|^approve|^preapprove/;
-       $f{Event}= $_;
+       $f{Event}= $_.$cathow;
        last;
     }
 }
index f6ea1d160de4d94c87e96b0220e9651d4f3c23e3..92a6a5e2793004467b195b4976a09f8cd3bc35d9 100755 (executable)
@@ -7,6 +7,8 @@ use CGI qw/:standard *table end_* -no_xhtml/;
 
 our $timesquash = 3;
 # no. of digits at end of time to replace with x, 0..4
+our %reasonshow = qw(approve 1 reject 1);
+# no. of words to show
 
 for (;;) {
     last unless @ARGV;
@@ -16,6 +18,8 @@ for (;;) {
     while (m/^-./) {
        if (s/^-t([0-4])/-/) {
            $timesquash= $1;
+       } elsif (s/^-r(\w+)=(\d)$//) {
+           $reasonshow{$1}= $2;
        } else {
            die "bad option $_ ?";
        }
@@ -75,6 +79,14 @@ sub processline_print () {
        $sp[5]= a({ href=>"$staticfiles/nr-$s[6].txt" }, $sp[5] );
     }
 
+    if ($sp[5] =~ m/^\w+\b/ &&
+       defined (my $reasonshow= $reasonshow{$&})) {
+       my @reas= split /\s+/, $sp[5];
+       $reasonshow--;
+       $#reas = $reasonshow if $#reas > $reasonshow;
+       $sp[5] = join ' ', @reas;
+    }
+
     print "<tr class='$oddeven'><td>$sp[0]</td>";
     print "<td class='ref'>$sp[1] $sp[2]</td>";
     print td([@sp[3..5]]),"</tr>\n";