whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit 4edad42: Fix https://issues.apache.org/jira/browse/WHIMSY-48
Date Fri, 04 Mar 2016 20:48:52 GMT
Commit 4edad4246fd8e93cad9eeb3c7e5ad7c8ef21397f:
    Fix https://issues.apache.org/jira/browse/WHIMSY-48


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@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} <#{env.user}@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)

Mime
View raw message