Commit ed1c712c2a2dd7573f92d3ed80423d80f054373a:
    mail lists

Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>

------------------------------------------------------------
www/roster/main.rb                                           | ++ --
www/roster/models/committee.rb                               | ++++++ --
www/roster/views/pmc/main.js.rb                              | +++++++++ 
------------------------------------------------------------
37 changes: 31 additions, 6 deletions.
------------------------------------------------------------


diff --git a/www/roster/main.rb b/www/roster/main.rb
index 0ca4b0d..00463de 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -56,12 +56,12 @@
 end
 
 get '/committee/:name.json' do |name|
-  _json Committee.serialize(name)
+  _json Committee.serialize(name, env)
 end
 
 get '/committee/:name' do |name|
   @auth = Auth.info(env)
-  @committee = Committee.serialize(name)
+  @committee = Committee.serialize(name, env)
   pass unless @committee
   _html :committee
 end
diff --git a/www/roster/models/committee.rb b/www/roster/models/committee.rb
index 9451b11..a8ec3ff 100644
--- a/www/roster/models/committee.rb
+++ b/www/roster/models/committee.rb
@@ -1,5 +1,5 @@
 class Committee
-  def self.serialize(id)
+  def self.serialize(id, env)
     response = {}
 
     pmc = ASF::Committee.find(id)
@@ -9,8 +9,16 @@ def self.serialize(id)
     ASF::Committee.load_committee_info
     people = ASF::Person.preload('cn', (pmc.members + committers).uniq)
 
-    prefix = pmc.mail_list + '-'
-    lists = ASF::Mail.lists(true).select {|list| list.start_with? prefix}
+    lists = ASF::Mail.lists(true).select do |list, mode|
+      list =~ /^#{pmc.mail_list}\b/
+    end
+
+    unless
+      pmc.roster.include? env.user or
+      ASF::Person.find(env.user).asf_member?
+    then
+      lists = lists.select {|list, mode| mode == 'public'}
+    end
 
     response = {
       id: id,
@@ -24,7 +32,7 @@ def self.serialize(id)
       ldap: Hash[pmc.members.map {|person| [person.id, person.cn]}],
       committers: Hash[committers.map {|person| [person.id, person.cn]}],
       roster: pmc.roster,
-      mail: Hash[lists]
+      mail: Hash[lists.sort]
     }
 
     response
diff --git a/www/roster/views/pmc/main.js.rb b/www/roster/views/pmc/main.js.rb
index 7d416aa..400e85d 100644
--- a/www/roster/views/pmc/main.js.rb
+++ b/www/roster/views/pmc/main.js.rb
@@ -40,6 +40,23 @@ def render
     _PMCMembers auth: auth, committee: @committee
     _PMCCommitters auth: auth, committee: @committee
 
+    _h2 'Mail lists'
+    _ul do
+      for name in @committee.mail
+        _li do
+          if @committee.mail[name] == 'public'
+            _a name, href: "http://mail-archives.apache.org/mod_mbox/#{name}/";
+          elsif @@committee.roster[@@auth.id]
+            _a name, href: 
+              "https://mail-search.apache.org/pmc/private-arch/#{name}/";
+          else
+            _a name, href: 
+              "https://mail-search.apache.org/members/private-arch/#{name}/";
+          end
+        end
+      end
+    end
+
     # reporting schedule
     _h2 'Reporting Schedule'
     _ul do

Reply via email to