whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Simplify id validation - copy code from committee
Date Fri, 15 Dec 2017 13:37:29 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb 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 beab937  Simplify id validation - copy code from committee
beab937 is described below

commit beab9374c9267dca7e48eaefcc9b32eb9ec84eb8
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Dec 15 13:37:15 2017 +0000

    Simplify id validation - copy code from committee
---
 www/roster/views/actions/ppmc.json.rb | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/www/roster/views/actions/ppmc.json.rb b/www/roster/views/actions/ppmc.json.rb
index 0f29252..fb476e5 100644
--- a/www/roster/views/actions/ppmc.json.rb
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -1,6 +1,12 @@
 if env.password
-  # Allow for missing people
-  people = @ids.split(',').map {|id| ASF::Person[id] || ASF::Person.find(id) }
+
+  # validate ids
+  if @action == 'remove' 
+    people = @ids.split(',').map {|id| ASF::Person.find(id)}
+  else
+    people = @ids.split(',').map {|id| ASF::Person[id]}
+    raise ArgumentError.new("ids=#{@ids}") if people.any? {|person| person.nil?}
+  end
 
   # if target is ONLY icommit, use incubator in the email message, etc.
   # Otherwise, use the project (podling).
@@ -10,11 +16,6 @@ if env.password
     project = ASF::Project[@project]
   end
 
-  # validate arguments (dn attribute is only present for real people)
-  if @action != 'remove' and people.any? {|person| person.attrs['dn'].nil?}
-    raise ArgumentError.new("ids=#{@ids}") 
-  end
-
   unless @action == 'add' and @targets.include? 'ldap'
     raise ArgumentError.new("project=#{@project}") unless project
   end

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

Mime
View raw message