From 199809b60ed580754ebfad7fd77b18ad2369c9a2 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Tue, 12 Jan 2016 13:29:45 +0100 Subject: !proj: Distinguish between non-existing and empty projects Fixes: https://bugs.gentoo.org/show_bug.cgi?id=571614 --- gentoo-data.rb | 22 ++++++++++++++++------ 1 file 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 -- cgit v1.2.3-65-gdbad