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 8e0f91b  Keep trying; need to have a valid Person object
8e0f91b is described below

commit 8e0f91b5852daf96b736c1e03d8efdc1273b80ec
Author: Sebb <[email protected]>
AuthorDate: Thu Dec 14 14:11:02 2017 +0000

    Keep trying; need to have a valid Person object
---
 www/roster/views/actions/ppmc.json.rb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/www/roster/views/actions/ppmc.json.rb 
b/www/roster/views/actions/ppmc.json.rb
index b0adf29..0f29252 100644
--- a/www/roster/views/actions/ppmc.json.rb
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -1,5 +1,6 @@
 if env.password
-  people = @ids.split(',').map {|id| ASF::Person[id]}
+  # Allow for missing people
+  people = @ids.split(',').map {|id| ASF::Person[id] || ASF::Person.find(id) }
 
   # if target is ONLY icommit, use incubator in the email message, etc.
   # Otherwise, use the project (podling).
@@ -9,8 +10,8 @@ if env.password
     project = ASF::Project[@project]
   end
 
-  # validate arguments
-  if @action != 'remove' and people.any? {|person| person.nil?}
+  # 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
 
@@ -73,7 +74,7 @@ if env.password
   # extract people's names (for short lists) or ids (for longer lists)
   if people.length <= 2
     # Person may not exist when ids are renamed
-    who = people.map {|person| (person.public_name rescue person.id rescue '?' 
)}.join(' and ')
+    who = people.map {|person| (person.public_name || person.id )}.join(' and 
')
   else
     who = people[0..-2].map {|person| person.id}.join(', ') + 
       ', and ' + people.last.id

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to