diff options
author | 2016-01-12 13:29:45 +0100 | |
---|---|---|
committer | 2016-01-12 20:08:53 +0100 | |
commit | 199809b60ed580754ebfad7fd77b18ad2369c9a2 (patch) | |
tree | 560a5327194f706ad7c27291b63cf6f335633e4a | |
parent | Add !proj to obtain project members from projects.xml (diff) | |
download | rbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.tar.gz rbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.tar.bz2 rbot-gentoo-199809b60ed580754ebfad7fd77b18ad2369c9a2.zip |
!proj: Distinguish between non-existing and empty projects
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=571614
-rw-r--r-- | gentoo-data.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gentoo-data.rb b/gentoo-data.rb index 79c3b34..37b606f 100644 --- a/gentoo-data.rb +++ b/gentoo-data.rb @@ -208,25 +208,35 @@ class GentooPlugin < Plugin break end } - emails = [] if project + emails = [] for maintainer in project.get_elements("member") emails << maintainer.get_elements('email')[0].text.chomp('@gentoo.org') end for subproject in project.get_elements("subproject") if subproject.attributes["inherit-members"] == "1" - emails += expand_project_recursively(projects, + sub_emails = expand_project_recursively(projects, subproject.attributes["ref"]) + if sub_emails.nil? + emails << "<#{subproject.attributes["ref"]}>" + else + emails += sub_emails + end end end + return emails + else + return nil end - return emails end emails = expand_project_recursively(projects, req_project) - unless emails.empty? - m.reply "(#{req_project}) #{emails.sort.uniq.join(', ')}" - else + + if emails.nil? m.reply "No such project: #{req_project}" + elsif emails.empty? + m.reply "(#{req_project}) [no members]" + else + m.reply "(#{req_project}) #{emails.sort.uniq.join(', ')}" end end |