Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a notes field and post a note if Redmine groups came back empty #6

Merged
merged 2 commits into from
Jul 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def get(self):

result = dict()
projects = dict()
notes = list()

redmine = Redmine(redmineurl, key=apikey)

Expand Down Expand Up @@ -149,6 +150,12 @@ def get(self):
assign_ids.append(group.id)
rm_groups[group.id] = group

# if groups are empty we might not have the rights to retrieve them, cf.
# https://github.com/penguineer/RedmineActionablesCollector/issues/1
if not rm_groups:
notes.append("Redmine groups came back empty. "
"Either there are no groups or you do not have sufficient rights to retrieve groups!")

# filter IDs of those issues assigned to the current user
issues_actionable = set(map(lambda i: i.id,
filter(
Expand Down Expand Up @@ -332,6 +339,8 @@ def get(self):
issues[issue.id] = entry
result['issues'] = issues

result['notes'] = notes

self.set_header("Content-Type", "application/json")
self.write(json.dumps(result, indent=4))
self.set_status(200)
Expand Down