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 50e7902  WHIMSY-168 Mail address matching does not take case into 
account
50e7902 is described below

commit 50e7902c43a98231ed8a80d47c25c6146de4d23c
Author: Sebb <[email protected]>
AuthorDate: Wed Dec 20 23:55:54 2017 +0000

    WHIMSY-168 Mail address matching does not take case into account
    
    Show actual subscriptions (original casing)
---
 www/roster/models/committee.rb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/www/roster/models/committee.rb b/www/roster/models/committee.rb
index 766ed30..56d8801 100644
--- a/www/roster/models/committee.rb
+++ b/www/roster/models/committee.rb
@@ -35,8 +35,9 @@ class Committee
         analysePrivateSubs = !(pMods & user_mail).empty?
       end
       if analysePrivateSubs
-        pSubs = canonhost(ASF::MLIST.private_subscribers(pmc.mail_list)[0]||[])
-        unMatchedSubs=Array.new(pSubs) # init ready to remove matched mails
+        pSubs = ASF::MLIST.private_subscribers(pmc.mail_list)[0]||[]
+        unMatchedSubs=Set.new(pSubs) # init ready to remove matched mails
+        pSubs.map!{|m| m.downcase} # for matching
       end
     else
       lists = lists.select {|list, mode| mode == 'public'}
@@ -51,9 +52,9 @@ class Committee
         role: 'PMC member'
       }
       if analysePrivateSubs
-        allMail = canonhost(person.all_mail)
+        allMail = person.all_mail.map{|m| m.downcase}
         roster[person.id]['notSubbed'] = (allMail & pSubs).empty?
-        unMatchedSubs -= allMail
+        unMatchedSubs.delete_if {|k| allMail.include? k.downcase}
       end
       roster[person.id]['ldap'] = true
     end
@@ -77,7 +78,7 @@ class Committee
       unMatchedSubs.each{ |addr|
         who = nil
         @people.each do |person|
-          if person[:mail].any? {|mail| mail == addr}
+          if person[:mail].any? {|mail| mail.downcase == addr.downcase}
             who = person
           end
         end
@@ -144,8 +145,4 @@ class Committee
     @people
   end
 
-  # 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
['"[email protected]" <[email protected]>'].

Reply via email to