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/03/13 13:16:21 UTC
[whimsy] branch master updated: Highlight lists with few (or no)
subscribers
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 e19f694 Highlight lists with few (or no) subscribers
e19f694 is described below
commit e19f69463a43cbd6991671a6640d837c4605e067
Author: Sebb <se...@apache.org>
AuthorDate: Wed Mar 13 13:16:16 2019 +0000
Highlight lists with few (or no) subscribers
---
www/members/security-subs.cgi | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/www/members/security-subs.cgi b/www/members/security-subs.cgi
index 754fd5b..3eacc77 100755
--- a/www/members/security-subs.cgi
+++ b/www/members/security-subs.cgi
@@ -11,6 +11,14 @@ WHITELIST = [
/^apmail-\w+-security-archive@www.apache.org/, # Direct subscription
]
+def isArchiver?(email)
+ WHITELIST.any? {|regex| email =~ regex}
+end
+
+NOSUBSCRIBERS = 'No subscribers'
+MINSUB = 3
+TOOFEW = "Not enough subscribers (< #{MINSUB})"
+
# ensure that there is a trailing slash (so relative paths will work)
if not ENV['PATH_INFO']
print "Status: 302 Found\r\nLocation: #{ENV['SCRIPT_URI']}/\r\n\r\n"
@@ -33,6 +41,11 @@ _html do
}
) do
+ _p do
+ _ 'The counts below exclude the archivers, using the highlights: '
+ _span.bg_danger NOSUBSCRIBERS
+ _span.bg_warning TOOFEW
+ end
path = ENV['PATH_INFO'].sub('/', '')
if path == ''
_table.table.table_responsive do
@@ -48,7 +61,17 @@ _html do
lists.each_slice(3) do |slice|
_tr do
slice.each do |dom, subs|
- _td.text_right subs.length
+ arch = subs.select{|sub| isArchiver?(sub)}.length
+ subcount = (subs.length - arch)
+ options = {}
+ if subcount == 0
+ options = {class: 'bg-danger', title: NOSUBSCRIBERS}
+ elsif subcount < MINSUB
+ options = {class: 'bg-warning', title: TOOFEW}
+ end
+ _td.text_right options do
+ _ subcount
+ end
_td do
_a dom, href: dom
end