From 73ab10ce2582ea5b4e41465e075cde89cd2a73fb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 17 Dec 2014 16:37:25 +0000 Subject: [PATCH] xlog: Optionally show more approval/rejection reasons * 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 --- webstump/scripts/filter.lib.pl | 1 + xlog/bin/record | 6 +++++- xlog/bin/report | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/webstump/scripts/filter.lib.pl b/webstump/scripts/filter.lib.pl index 3a41cb5..965d816 100644 --- a/webstump/scripts/filter.lib.pl +++ b/webstump/scripts/filter.lib.pl @@ -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 ); diff --git a/xlog/bin/record b/xlog/bin/record index 2408833..916be12 100755 --- a/xlog/bin/record +++ b/xlog/bin/record @@ -96,10 +96,14 @@ sub parse_webstump2stump () { parse__stumpsubject(); last if m/^$/; } + my $cathow = ''; while () { chomp; + if (m/^\#( \w+.*)$/) { + $cathow = $1; + } next unless m/^reject|^approve|^preapprove/; - $f{Event}= $_; + $f{Event}= $_.$cathow; last; } } diff --git a/xlog/bin/report b/xlog/bin/report index f6ea1d1..92a6a5e 100755 --- a/xlog/bin/report +++ b/xlog/bin/report @@ -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 "$sp[0]"; print "$sp[1] $sp[2]"; print td([@sp[3..5]]),"\n"; -- 2.30.2