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 f1414fe Link moderators to committer entries (if email known)
f1414fe is described below
commit f1414fe5239d3c7a43e15f637c5ffbe54f8cd631
Author: Sebb <[email protected]>
AuthorDate: Wed Jan 24 21:10:38 2018 +0000
Link moderators to committer entries (if email known)
---
www/roster/models/committee.rb | 13 ++++++++++++-
www/roster/models/ppmc.rb | 38 ++++++++++++++++++++++++++++++++++++++
www/roster/views/pmc/main.js.rb | 19 ++++++++++++++++++-
www/roster/views/ppmc/main.js.rb | 19 ++++++++++++++++++-
4 files changed, 86 insertions(+), 3 deletions(-)
diff --git a/www/roster/models/committee.rb b/www/roster/models/committee.rb
index a3e1f3d..7af3e43 100644
--- a/www/roster/models/committee.rb
+++ b/www/roster/models/committee.rb
@@ -74,7 +74,10 @@ class Committee
# separate out the known ASF members and extract any matching committer
details
unknownSubs = []
asfMembers = []
- if unMatchedSubs.length > 0
+ # Also look for non-ASF mod emails
+ nonASFmails=Hash.new
+ moderators.each { |list,mods| mods.each {|m| nonASFmails[m]='' unless
m.end_with? '@apache.org'} }
+ if unMatchedSubs.length > 0 or nonASFmails.length > 0
load_emails # set up @people
unMatchedSubs.each{ |addr|
who = nil
@@ -93,6 +96,13 @@ class Committee
unknownSubs << { addr: addr, person: nil }
end
}
+ nonASFmails.each {|k,v|
+ @people.each do |person|
+ if person[:mail].any? {|mail| mail.downcase == k.downcase}
+ nonASFmails[k] = person[:id]
+ end
+ end
+ }
end
response = {
@@ -111,6 +121,7 @@ class Committee
mail: Hash[lists.sort],
moderators: moderators,
modtime: modtime,
+ nonASFmails: nonASFmails,
project_info: info,
image: image,
guinea_pig: ASF::Committee::GUINEAPIGS.include?(id),
diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
index bd91196..572ea82 100644
--- a/www/roster/models/ppmc.rb
+++ b/www/roster/models/ppmc.rb
@@ -9,10 +9,22 @@ class PPMC
list =~ /^(incubator-)?#{ppmc.mail_list}\b/
end
+ # Also look for non-ASF mod emails
+ nonASFmails=Hash.new
+
user = ASF::Person.find(env.user)
if user.asf_member? or ppmc.members.include? user
require 'whimsy/asf/mlist'
moderators, modtime = ASF::MLIST.list_moderators(ppmc.mail_list, true)
+ load_emails # set up @people
+ moderators.each { |list,mods| mods.each {|m| nonASFmails[m]='' unless
m.end_with? '@apache.org'} }
+ nonASFmails.each {|k,v|
+ @people.each do |person|
+ if person[:mail].any? {|mail| mail.downcase == k.downcase}
+ nonASFmails[k] = person[:id]
+ end
+ end
+ }
else
lists = lists.select {|list, mode| mode == 'public'}
end
@@ -60,6 +72,7 @@ class PPMC
mail: Hash[lists.sort],
moderators: moderators,
modtime: modtime,
+ nonASFmails: nonASFmails,
duration: ppmc.duration,
podlingStatus: statusInfo,
namesearch: ppmc.namesearch,
@@ -67,4 +80,29 @@ class PPMC
response
end
+
+ private
+
+ def self.load_emails
+ # recompute index if the data is 5 minutes old or older
+ @people = nil if not @people_time or Time.now-@people_time >= 300
+
+ if not @people
+ # bulk loading the mail information makes things go faster
+ mail = Hash[ASF::Mail.list.group_by(&:last).
+ map {|person, list| [person, list.map(&:first)]}]
+
+ # build a list of people, their public-names, and email addresses
+ @people = ASF::Person.list.map {|person|
+ result = {id: person.id, name: person.public_name, mail: mail[person]}
+ result[:member] = true if person.asf_member?
+ result
+ }
+
+ # cache
+ @people_time = Time.now
+ end
+ @people
+ end
+
end
diff --git a/www/roster/views/pmc/main.js.rb b/www/roster/views/pmc/main.js.rb
index 9fbf4cb..e7fc961 100644
--- a/www/roster/views/pmc/main.js.rb
+++ b/www/roster/views/pmc/main.js.rb
@@ -114,7 +114,24 @@ class PMC < Vue
_a list_name, href: 'https://lists.apache.org/list.html?' +
list_name
end
- _td @committee.moderators[list_name].join(', ')
+ _td do
+ sep=''
+ @committee.moderators[list_name].each { |mod|
+ _ sep
+ id=nil
+ if mod.end_with? '@apache.org'
+ id=mod.sub(/@a.*/,'')
+ else
+ id = @committee.nonASFmails[mod]
+ end
+ if id
+ _a mod, href: "committer/#{id}"
+ else
+ _ mod
+ end
+ sep=', '
+ }
+ end
end
end
end
diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
index 6ccd0b6..04e9e12 100644
--- a/www/roster/views/ppmc/main.js.rb
+++ b/www/roster/views/ppmc/main.js.rb
@@ -109,7 +109,24 @@ class PPMC < Vue
_a list_name, href: 'https://lists.apache.org/list.html?' +
list_name
end
- _td @ppmc.moderators[list_name].join(', ')
+ _td do
+ sep=''
+ @ppmc.moderators[list_name].each { |mod|
+ _ sep
+ id=nil
+ if mod.end_with? '@apache.org'
+ id=mod.sub(/@a.*/,'')
+ else
+ id = @ppmc.nonASFmails[mod]
+ end
+ if id
+ _a mod, href: "committer/#{id}"
+ else
+ _ mod
+ end
+ sep=', '
+ }
+ end
end
end
end
--
To stop receiving notification emails like this one, please contact
[email protected].