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 e96e930  Centralise archiver name checking
e96e930 is described below

commit e96e930341416eca2f03f74a926dfeac049cdccf
Author: Sebb <[email protected]>
AuthorDate: Mon Aug 16 00:40:48 2021 +0100

    Centralise archiver name checking
---
 lib/whimsy/asf/mlist.rb       | 11 ++++++++++-
 www/members/security-subs.cgi | 13 +------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index f4050bd..360a0bb 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -293,6 +293,12 @@ module ASF
       ARCHIVERS.include?(e) or is_mino_archiver?(e) or is_whimsy_archiver?(e) 
or is_markmail_archiver?(e)
     end
 
+    def self.is_private_archiver?(e)
+      [ARCH_MBOX_PRV, ARCH_PONY_PRV].include? (e) or
+        e =~ /^security-archive@.*\.apache\.org$/ or
+        e =~ /^apmail-\[email protected]/ # direct 
subscription
+    end
+
     def self.downcase(array)
       array.map(&:downcase)
     end
@@ -398,7 +404,10 @@ module ASF
 
     ARCHIVERS = [ARCH_PONY_PRV, ARCH_PONY_PUB,
                  ARCH_MBOX_PUB, ARCH_MBOX_PRV, ARCH_MBOX_RST, 
ARCH_EXT_MAIL_ARCHIVE]
-    # TODO alias archivers: either add list or use RE to filter them
+
+    # Private archivers
+    ARCHIVERS_PRV = [ARCH_PONY_PRV, ARCH_MBOX_PRV]
+     # TODO alias archivers: either add list or use RE to filter them
 
     LIST_BASE = ASF::Config[:subscriptions] # allow overrides for testing etc
 
diff --git a/www/members/security-subs.cgi b/www/members/security-subs.cgi
index 48fc2bc..400786f 100755
--- a/www/members/security-subs.cgi
+++ b/www/members/security-subs.cgi
@@ -4,17 +4,6 @@ require 'wunderbar/bootstrap'
 require 'whimsy/asf'
 require 'whimsy/asf/mlist'
 
-WHITELIST = [
-  /^archive-asf-private@cust-asf\.ponee\.io$/,
-  /^private@mbox-vm\.apache\.org$/,
-  /^security-archive@.*\.apache\.org$/,
-  /^apmail-\[email protected]/, # Direct subscription
-]
-
-def isArchiver?(email)
-  WHITELIST.any? {|regex| email =~ regex}
-end
-
 NOSUBSCRIBERS = 'No subscribers'
 MINSUB = 3
 TOOFEW = "Not enough subscribers (< #{MINSUB})"
@@ -34,7 +23,7 @@ ASF::MLIST.list_parse('sub') do |dom, list, subs|
   ids = Hash.new(0) # currently used as a set
   sub_hash = subs.map do |sub|
     person = nil # unknown
-    if isArchiver? sub
+    if ASF::MLIST.is_private_archiver? sub
       person = ''
     else
       person = ASF::Person.find_by_email(sub)

Reply via email to