You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/04/27 12:53:28 UTC

[whimsy] branch master updated: Tool to list all subscriptions

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

rubys 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  2013e9f   Tool to list all subscriptions
2013e9f is described below

commit 2013e9f58e18def11b4039964767d173078940bc
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Thu Apr 27 08:52:46 2017 -0400

    Tool to list all subscriptions
    
    Fixes https://issues.apache.org/jira/browse/WHIMSY-87
---
 DEPLOYMENT.md                  |  7 ++++---
 www/roster/models/committer.rb | 18 ++++++++++++++++++
 www/roster/views/person.js.rb  | 17 +++++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md
index ff38a7b..4008010 100644
--- a/DEPLOYMENT.md
+++ b/DEPLOYMENT.md
@@ -60,10 +60,11 @@ The following additional steps are required to get the Whimsy VM up and running:
    `whimsysvn` user.
 
  * Add the following cron job to apmail@hermes:
-     * `11  4,10,16,22 * * * for list in /home/apmail/lists/incubator.apache.org/*; do echo; echo $list/mod; ezmlm-list $list mod; done | ssh whimsy-vm3.apache.org 'cat > /srv/subscriptions/incubator-mods'`
+     * `11  4,10,16,22 * * * for list in /home/apmail/lists/incubator.apache.org/*; do echo; echo $list/mod; ezmlm-list $list mod; done | ssh whimsy-vm4.apache.org 'cat > /srv/subscriptions/incubator-mods'`
      * `11  1,7,13,19   *       *       *       for list in /home/apmail/lists/*apache.org/*; do echo; echo $list/mod; ezmlm-list $list mod; done 2>/dev/null | ssh whimsy-vm4.apache.org 'cat > /srv/subscriptions/list-mods'`
-     * `16 * * * * ezmlm-list /home/apmail/lists/apache.org/board/ . | ssh whimsy-vm3.apache.org 'cat > /srv/subscriptions/board'`
-     * `46 * * * * ezmlm-list /home/apmail/lists/apache.org/members/ . | ssh whimsy-vm3.apache.org 'cat > /srv/subscriptions/members'`
+     * `11  3,9,15,21   *       *       *       for list in /home/apmail/lists/*apache.org/*; do echo; echo $list/mod; ezmlm-list $list 2>/dev/null; done | ssh whimsy-vm4.apache.org 'cat > /srv/subscriptions/list-subs'`
+     * `16 * * * * ezmlm-list /home/apmail/lists/apache.org/board/ . | ssh whimsy-vm4.apache.org 'cat > /srv/subscriptions/board'`
+     * `46 * * * * ezmlm-list /home/apmail/lists/apache.org/members/ . | ssh whimsy-vm4.apache.org 'cat > /srv/subscriptions/members'`
 
  * Add the following mail subscriptions:
     * Subscribe `svnupdate@whimsy-vm3.apache.org` to `board@apache.org`.
diff --git a/www/roster/models/committer.rb b/www/roster/models/committer.rb
index 1ce3d22..26217f0 100644
--- a/www/roster/models/committer.rb
+++ b/www/roster/models/committer.rb
@@ -1,4 +1,6 @@
 class Committer
+  LIST_SUBS = '/srv/subscriptions/list-subs'
+
   def self.serialize(id, env)
     response = {}
 
@@ -136,6 +138,22 @@ class Committer
       end
     end
 
+    if env.user == id and File.exists? LIST_SUBS
+      response[:subscriptions] = []
+      emails = person.all_mail
+
+      File.read(LIST_SUBS).split(/\n\n/).each do |stanza|
+        list = stanza.match(/(\w*\.?apache\.org)\/(.*?)(\n|\Z)/)
+
+        subs = stanza.scan(/^(.*@.*)/).flatten
+        emails.each do |email|
+          if subs.include? email
+            response[:subscriptions] << ["#{list[2]}@#{list[1]}", email]
+          end
+        end
+      end
+    end
+
     response
   end
 end
diff --git a/www/roster/views/person.js.rb b/www/roster/views/person.js.rb
index e03fcba..a131e8b 100644
--- a/www/roster/views/person.js.rb
+++ b/www/roster/views/person.js.rb
@@ -92,6 +92,23 @@ class Person < React
           end
         end
 
+        # subscriptions
+        if @committer.subscriptions
+          _tr do
+            _td 'Subscriptions'
+            _td do
+              _ul @committer.subscriptions 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
+            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>'].