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 5309601  Downcase hostnames for better matching
5309601 is described below

commit 5309601d1fe614d0dcc0e076afe9740556463088
Author: Sebb <s...@apache.org>
AuthorDate: Wed Oct 25 02:20:10 2017 +0100

    Downcase hostnames for better matching
---
 www/roster/models/committee.rb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/www/roster/models/committee.rb b/www/roster/models/committee.rb
index 55b6f90..211ec17 100644
--- a/www/roster/models/committee.rb
+++ b/www/roster/models/committee.rb
@@ -35,7 +35,7 @@ class Committee
         analysePrivateSubs = !(pMods & user_mail).empty?
       end
       if analysePrivateSubs
-        pSubs, _ = ASF::MLIST.private_subscribers(pmc.mail_list)
+        pSubs = canonhost(ASF::MLIST.private_subscribers(pmc.mail_list)[0]||[])
         unknownSubs=Array.new(pSubs) # init ready to remove matched mails
       end
     else
@@ -51,8 +51,9 @@ class Committee
         role: 'PMC member'
       }
       if analysePrivateSubs
-        roster[person.id]['notSubbed'] = (person.all_mail & pSubs).empty?
-        unknownSubs -= person.all_mail
+        allMail = canonhost(person.all_mail)
+        roster[person.id]['notSubbed'] = (allMail & pSubs).empty?
+        unknownSubs -= allMail
       end
       roster[person.id]['ldap'] = true
     end
@@ -93,4 +94,11 @@ class Committee
 
     response
   end
+
+  private
+
+  # canonicalise hostnames
+  def self.canonhost(list)
+    list.map {|i| i.sub(/@.+/) { |m| m.downcase } }
+  end
 end

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

Reply via email to