You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/03/04 21:48:52 UTC

[whimsy.git] [1/1] Commit 4edad42: Fix https://issues.apache.org/jira/browse/WHIMSY-48

Commit 4edad4246fd8e93cad9eeb3c7e5ad7c8ef21397f:
    Fix https://issues.apache.org/jira/browse/WHIMSY-48


Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>

------------------------------------------------------------
www/roster/Gemfile                                           | + 
www/roster/main.rb                                           | ++ 
www/roster/views/actions/committee.json.rb                   | +++++++++++++++ 
------------------------------------------------------------
32 changes: 32 additions, 0 deletions.
------------------------------------------------------------


diff --git a/www/roster/Gemfile b/www/roster/Gemfile
index d7127d4..855d59a 100644
--- a/www/roster/Gemfile
+++ b/www/roster/Gemfile
@@ -17,6 +17,7 @@ gem 'ruby2js', '>= 2.0.0'
 gem 'sinatra'
 gem 'nokogumbo'
 gem 'execjs'
+gem 'mail'
 
 group :development do
   gem 'passenger'
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 9949620..084d675 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -7,6 +7,8 @@
 require 'whimsy/asf'
 require 'whimsy/asf/podlings'
 
+require 'mail'
+
 require 'wunderbar/sinatra'
 require 'wunderbar/bootstrap/theme'
 require 'wunderbar/react'
diff --git a/www/roster/views/actions/committee.json.rb b/www/roster/views/actions/committee.json.rb
index c3ccea1..72d4321 100644
--- a/www/roster/views/actions/committee.json.rb
+++ b/www/roster/views/actions/committee.json.rb
@@ -1,4 +1,5 @@
 if env.password
+  # update LDAP
   ASF::LDAP.bind(env.user, env.password) do
     person = ASF::Person.find(@id)
     pmc = ASF::Committee.find(@pmc) if @targets.include? 'pmc'
@@ -12,6 +13,34 @@
       group.remove(person) if group
     end
   end
+
+  # compose E-mail
+  action = (@action == 'add' ? 'added to' : 'removed from')
+  if pmc
+    list = group ? 'PMC and committers list' : 'PMC list'
+  else
+    list = 'committers list'
+  end
+
+  details = [person.dn]
+  details << group.dn if group
+  details << pmc.dn if pmc
+
+  pmc ||= ASF::Committee.find(@pmc)
+
+  mail = Mail.new do
+    from "#{ASF::Person.find(env.user).public_name} <#{...@apache.org>"
+    to "private@#{pmc.mail_list}.apache.org"
+    bcc "root@apache.org"
+    subject "#{person.public_name} #{action} #{pmc.display_name} #{list}"
+    body "Current roster can be found at:\n\n" +
+      "  https://whimsy.apache.org/roster/committee/#{pmc.id}\n\n" +
+      "LDAP details:\n\n  #{details.join("\n  ")}"
+  end
+
+  # deliver email
+  mail.deliver!
 end
 
+# return updated committee info to the client
 Committee.serialize(@pmc, env)