Skip to content

Commit

Permalink
[webui] Refactor User#incoming_requests
Browse files Browse the repository at this point in the history
- Remove duplicate with_actions and in_states call
- Remove variables
  • Loading branch information
ChrisBr committed Jun 27, 2017
1 parent bb5fc0c commit 43caafa
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/api/app/models/user.rb
Expand Up @@ -752,12 +752,9 @@ def declined_requests(search = nil)

# list incoming requests involving this user
def incoming_requests(search = nil)
project_ids = involved_projects.pluck(:id)
package_ids = involved_packages.pluck(:id)

result = BsRequest.with_actions.with_involved_projects(project_ids)
.or(BsRequest.with_actions.with_involved_packages(package_ids))
.in_states(:new)
result = BsRequest.with_involved_projects(involved_projects.pluck(:id)).or(
BsRequest.with_involved_packages(involved_packages.pluck(:id))
).with_actions.in_states(:new)

search ? result.do_search(search) : result
end
Expand Down

0 comments on commit 43caafa

Please sign in to comment.