This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 62bc5757 Initial release of list moderator checks
62bc5757 is described below

commit 62bc5757402c9efc1655c84221d2dcc7795f87c2
Author: Sebb <[email protected]>
AuthorDate: Wed Apr 20 14:22:10 2022 +0100

    Initial release of list moderator checks
---
 www/members/moderator_checks.cgi | 72 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/www/members/moderator_checks.cgi b/www/members/moderator_checks.cgi
new file mode 100755
index 00000000..a9978e2f
--- /dev/null
+++ b/www/members/moderator_checks.cgi
@@ -0,0 +1,72 @@
+#!/usr/bin/env ruby
+PAGETITLE = "Apache List Moderator checks" # Wvisible:members
+$LOAD_PATH.unshift '/srv/whimsy/lib'
+
+# check moderators are known
+
+require 'wunderbar'
+require 'whimsy/asf'
+require 'whimsy/asf/mlist'
+require 'wunderbar/bootstrap'
+require 'wunderbar/jquery/stupidtable'
+
+MODERATORS = %w{
+  [email protected]
+  [email protected]
+}
+
+_html do
+  _body? do
+    _whimsy_body(
+      title: PAGETITLE,
+      related: {
+        },
+      helpblock: -> {
+        _h2 'DRAFT - List moderators whose email addresses are not recognised'
+        _p 'If the domain is @apache.org, the email is most likely a typo'
+        _p 'In other cases, perhaps the email is not registered'
+        _p do
+          _b 'Emails are matched exactly - case is treated significant, even 
for domains'
+        end
+      }
+    ) do
+      lists, _time = ASF::MLIST.list_moderators(nil)
+      emails = ASF::Mail.list
+      unknown = Hash.new { |h,k| h[k] = []}
+      lists.each do |lid, mods|
+        mods.each do |mod|
+          unknown[mod] << lid unless MODERATORS.include? mod or emails[mod]
+        end
+      end
+
+      _table.table.table_striped do
+        _thead_ do
+          _tr do
+            _th 'Unknown email addresses', data_sort: 'string'
+            _th 'Lists moderated', data_sort: 'string'
+          end
+        end
+        _tbody do
+          unknown.sort_by {|x, y| p = x.split('@'); [p[1], p[0]]}.each do 
|email, lids|
+            _tr do
+              _td email
+              _td lids.join(',')
+            end
+          end
+        end
+      end
+
+      _script %{
+        var table = $(".table").stupidtable();
+        table.on("aftertablesort", function (event, data) {
+          var th = $(this).find("th");
+          th.find(".arrow").remove();
+          var dir = $.fn.stupidtable.dir;
+          var arrow = data.direction === dir.ASC ? "&uarr;" : "&darr;";
+          th.eq(data.column).append('<span class="arrow">' + arrow +'</span>');
+          });
+        }
+
+    end
+  end
+end

Reply via email to