whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: add mailing lists
Date Sun, 15 Jan 2017 22:26:15 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  76a0266   add mailing lists
76a0266 is described below

commit 76a0266208fbebfdfa98f813c2f6ce7f4092ad08
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sun Jan 15 17:26:01 2017 -0500

    add mailing lists
---
 lib/whimsy/asf/mail.rb           |  7 +++++++
 www/roster/main.rb               |  4 ++--
 www/roster/models/ppmc.rb        | 12 +++++++++++-
 www/roster/views/ppmc/main.js.rb | 12 ++++++++++++
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index 45c733b..abbce2f 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -159,4 +159,11 @@ module ASF
       end
     end
   end
+
+  class Podling
+    def mail_list
+      name
+    end
+  end
+
 end
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 4d8100d..db84a77 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -128,11 +128,11 @@ end
 
 # individual podling info
 get '/ppmc/:name.json' do |name|
-  _json PPMC.serialize(name)
+  _json PPMC.serialize(name, env)
 end
 
 get '/ppmc/:name' do |name|
-  @ppmc = PPMC.serialize(name)
+  @ppmc = PPMC.serialize(name, env)
   pass unless @ppmc
   _html :ppmc
 end
diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
index 534a278..ae5a9f9 100644
--- a/www/roster/models/ppmc.rb
+++ b/www/roster/models/ppmc.rb
@@ -1,9 +1,18 @@
 class PPMC
-  def self.serialize(id)
+  def self.serialize(id, env)
     response = {}
 
     ppmc = ASF::Podling.find(id)
 
+    lists = ASF::Mail.lists(true).select do |list, mode|
+      list =~ /^(incubator-)?#{ppmc.mail_list}\b/
+    end
+
+    user = ASF::Person.find(env.user)
+    unless user.asf_member? or pmc.members.include? user
+      lists = lists.select {|list, mode| mode == 'public'}
+    end
+
     response = {
       id: id,
       display_name: ppmc.display_name,
@@ -14,6 +23,7 @@ class PPMC
       roster: ppmc.members.map {|person|
         [person.id, {name: person.public_name, member: person.asf_member?}]
       }.to_h,
+      mail: Hash[lists.sort]
     }
 
     response
diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
index f5bba47..038fe51 100644
--- a/www/roster/views/ppmc/main.js.rb
+++ b/www/roster/views/ppmc/main.js.rb
@@ -26,6 +26,18 @@ class PPMC < React
     # main content
     _PPMCMembers auth: auth, ppmc: @ppmc
 
+    # mailing lists
+    _h2.mail! 'Mail lists'
+    _ul do
+      for mail_name in @ppmc.mail
+        parsed = mail_name.match(/^(.*?)-(.*)/)
+        _li do
+          _a mail_name, href: 'https://lists.apache.org/list.html?' +
+            "#{parsed[2]}@#{parsed[1]}.apache.org"
+        end
+      end
+    end
+
     # hidden form
     # _PPMCConfirm pmc: @ppmc.id, update: self.update if auth
   end

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

Mime
View raw message