You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/09/20 12:22:17 UTC

[whimsy] branch master updated: Centralise unsubscribable checks

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 291eb00  Centralise unsubscribable checks
291eb00 is described below

commit 291eb00ac7cee802df170643d676c70f1cd8e2ee
Author: Sebb <se...@apache.org>
AuthorDate: Fri Sep 20 13:22:07 2019 +0100

    Centralise unsubscribable checks
---
 lib/whimsy/asf/mail.rb       | 12 +++++++++++-
 www/committers/subscribe.cgi |  8 --------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index 9891114..3bbeb7f 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -75,6 +75,16 @@ module ASF
       YAML.load_file(File.join(apmail_bin, 'deprecated_mailing_lists.yml'))
     end
 
+		# These are not subscribable via Whimsy
+    CANNOT_SUB = %w(
+      ea secretary president treasurer chairman
+      committers
+      pmc-chairs
+      concom
+      concom-private
+      legal-internal
+    )
+
     # which lists are available for subscription via Whimsy?
     # member: true if member
     # pmc_chair: true if pmc_chair
@@ -84,7 +94,7 @@ module ASF
       if member
           lists = @lists.keys
           # These are not subscribable via Whimsy
-          lists.delete_if {|list| list =~ /^(ea|secretary|president|treasurer|chairman|committers|pmc-chairs)$/ }
+          lists -= CANNOT_SUB
           lists.delete_if {|list| list =~ /(^|-)security$|^security(-|$)/ }
           lists
       else
diff --git a/www/committers/subscribe.cgi b/www/committers/subscribe.cgi
index 55bcb98..affdcf7 100755
--- a/www/committers/subscribe.cgi
+++ b/www/committers/subscribe.cgi
@@ -14,13 +14,6 @@ $SAFE = 1
 
 FORMAT_NUMBER = 3 # json format number
 
-# lists which are not eligible for self-subscription
-BLACKLIST = %w{
-  concom
-  concom-private
-  legal-internal
-}
-
 user = ASF::Person.new($USER)
 # authz handled by httpd
 
@@ -45,7 +38,6 @@ ldap_pmcs = user.committees.map(&:mail_list) unless user.asf_member?
 ldap_pmcs += user.podlings.map(&:mail_list) unless user.asf_member?
 lists = ASF::Mail.cansub(user.asf_member?, ASF.pmc_chairs.include?(user), ldap_pmcs)
 lists -= ASF::Mail.deprecated
-lists -= BLACKLIST
 lists.sort!
 addrs = user.all_mail