Skip to content

Commit

Permalink
[frontend] Refactor query methods in Event::Request
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Apr 10, 2018
1 parent d0cd921 commit 3bf1c6d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/api/app/models/event/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,17 @@ def payload_with_diff
end

def reviewers
ret = []
BsRequest.find_by_number(payload['number']).reviews.each do |r|
ret.concat(r.users_and_groups_for_review)
end
ret.uniq
BsRequest.find_by_number(payload['number']).reviews.map(&:users_and_groups_for_review).flatten.uniq
end

def creators
[User.find_by_login(payload['author'])]
end

def action_maintainers(prjname, pkgname)
ret = []
payload['actions'].each do |a|
ret.concat _roles('maintainer', a[prjname], a[pkgname])
end
ret.uniq
payload['actions'].map do |action|
_roles('maintainer', action[prjname], action[pkgname])
end.flatten.uniq
end

def target_maintainers
Expand Down

0 comments on commit 3bf1c6d

Please sign in to comment.