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 2017/12/12 20:21:47 UTC

[whimsy] branch master updated: Show user digest subs (if data present)

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 4db4ffe  Show user digest subs (if data present)
4db4ffe is described below

commit 4db4ffec4d5194844ad9888b4102d5ed3bda28de
Author: Sebb <se...@apache.org>
AuthorDate: Tue Dec 12 20:21:02 2017 +0000

    Show user digest subs (if data present)
---
 lib/whimsy/asf/mlist.rb        | 32 ++++++++++++++++++++++++++++++--
 www/roster/models/committer.rb |  2 ++
 www/roster/views/person.js.rb  | 18 ++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index 527c728..44ca958 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -47,6 +47,28 @@ module ASF
       response
     end
 
+    # return a hash of digest subscriptions for the list of emails provided
+    # the following keys are added to the response hash:
+    # :digtime - the timestamp when the data was last updated
+    # :digests - an array of pairs: [list name, subscriber email]
+    # N.B. not the same format as the moderates() method
+    def self.ß(emails, response = {})
+      
+      return response unless File.exists? LIST_DIGS
+
+      response[:digests] = []
+      response[:digtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_DIGS))
+
+      list_parse('dig') do |dom, list, subs|
+        emails.each do |email|
+          if subs.include? email
+            response[:digests] << ["#{list}@#{dom}", email]
+          end
+        end
+      end
+      response
+    end
+
     # return the mailing lists which are moderated by any of the list of emails
     # the following keys are added to the response hash:
     # :modtime - the timestamp when the data was last updated
@@ -99,7 +121,7 @@ module ASF
 
     # Filter the appropriate list, matching on domain and list
     # Params:
-    # - type: 'mod' or 'sub'
+    # - type: 'mod' or 'sub' or 'dig'
     # - matchdom: must match the domain (e.g. 'httpd.apache.org')
     # - matchlist: must match the list (e.g. 'dev')
     # - archivers: whether to include standard ASF archivers (default true)
@@ -119,7 +141,7 @@ module ASF
     end
     
     # Parses the list-mods/list-subs files
-    # Param: type = 'mod' or 'sub'
+    # Param: type = 'mod' or 'sub' or 'dig'
     # Yields:
     # - domain (e.g. [xxx.].apache.org)
     # - list (e.g. dev)
@@ -131,6 +153,9 @@ module ASF
       elsif type == 'sub'
         path = LIST_SUBS
         suffix = ''
+      elsif type == 'dig'
+        path = LIST_DIGS
+        suffix = ''
       else
         raise ArgumentError.new('type: expecting mod or sub')
       end
@@ -162,6 +187,8 @@ module ASF
 
     LIST_SUBS = '/srv/subscriptions/list-subs'
 
+    LIST_DIGS = '/srv/subscriptions/list-digs'
+
     # If this file exists, it is the time when the data was last extracted
     # The mods and subs files are only updated if they have changed
     LIST_TIME = '/srv/subscriptions/list-start'
@@ -171,4 +198,5 @@ end
 #if __FILE__ == $0
 #  p  ASF::MLIST.list_moderators(ARGV.shift||'blur', true)
 #  p  ASF::MLIST.private_subscribers(ARGV.shift||'whimsical')
+#  p  ASF::MLIST.digests(['chrisd@apache.org'])
 #end
diff --git a/www/roster/models/committer.rb b/www/roster/models/committer.rb
index 5333a07..34371a0 100644
--- a/www/roster/models/committer.rb
+++ b/www/roster/models/committer.rb
@@ -161,6 +161,8 @@ class Committer
     if env.user == id or auth[:root] or auth[:secretary]
       require 'whimsy/asf/mlist'
       ASF::MLIST.subscriptions(person.all_mail, response)
+      # (Does not update the response if the digest info is not available)
+      ASF::MLIST.digests(person.all_mail, response)
       # Check for missing private@ subscriptions
       response[:privateNosub] = []
       response[:committees].each do |id|
diff --git a/www/roster/views/person.js.rb b/www/roster/views/person.js.rb
index 6f70bcb..76caf36 100644
--- a/www/roster/views/person.js.rb
+++ b/www/roster/views/person.js.rb
@@ -147,6 +147,24 @@ class Person < Vue
       end
     end
 
+    # digests
+    if @committer.digests
+      _div.row do
+        _div.name 'Digest Subscriptions'
+        _div.value do
+          _ul @committer.digests do |list_email|
+            _li do
+              _a list_email[0],
+                href: 'https://lists.apache.org/list.html?' + list_email[0]
+              _span " as "
+              _span list_email[1]
+            end
+          end
+          _ "(last checked #{@committer.digtime})"
+        end
+      end
+    end
+
     # PGP keys
     if @committer.pgp
       _PersonPgpKeys person: self

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].