diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-13 14:39:09 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-13 14:39:09 +0000 |
commit | 16908f9718820dd651faa61396fedb997d10eadd (patch) | |
tree | 0137c0898875262caa4f541883f84970ce20a22c /app | |
parent | de67c5972084847c1517d1cf9e347cdb39a1a1ae (diff) | |
parent | 9abbe3cc860f5838df76405e59830efdacb07047 (diff) | |
download | gitlab-ce-16908f9718820dd651faa61396fedb997d10eadd.tar.gz |
Merge branch '26466-natural-sort-mrs' into 'master'
Group MR numbers on issue show page by project and namespace
Closes #26466
See merge request gitlab-org/gitlab-ce!8494
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/issues_controller.rb | 3 | ||||
-rw-r--r-- | app/services/issues/fetch_referenced_merge_requests_service.rb | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 515cb08f1fc..33fced99132 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -122,8 +122,7 @@ class Projects::IssuesController < Projects::ApplicationController end def referenced_merge_requests - @merge_requests = @issue.referenced_merge_requests(current_user) - @closed_by_merge_requests = @issue.closed_by_merge_requests(current_user) + @merge_requests, @closed_by_merge_requests = ::Issues::FetchReferencedMergeRequestsService.new(project, current_user).execute(issue) respond_to do |format| format.json do diff --git a/app/services/issues/fetch_referenced_merge_requests_service.rb b/app/services/issues/fetch_referenced_merge_requests_service.rb new file mode 100644 index 00000000000..39c8ded9df4 --- /dev/null +++ b/app/services/issues/fetch_referenced_merge_requests_service.rb @@ -0,0 +1,12 @@ +module Issues + class FetchReferencedMergeRequestsService < Issues::BaseService + def execute(issue) + referenced_merge_requests = issue.referenced_merge_requests(current_user) + referenced_merge_requests = Gitlab::IssuableSorter.sort(project, referenced_merge_requests) { |i| i.iid.to_s } + closed_by_merge_requests = issue.closed_by_merge_requests(current_user) + closed_by_merge_requests = Gitlab::IssuableSorter.sort(project, closed_by_merge_requests) { |i| i.iid.to_s } + + [referenced_merge_requests, closed_by_merge_requests] + end + end +end |