summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJeff Stubler <brunsa2@gmail.com>2017-01-08 17:09:00 -0600
committerJeff Stubler <brunsa2@gmail.com>2018-02-13 07:47:09 -0600
commit9abbe3cc860f5838df76405e59830efdacb07047 (patch)
treedcdb5b75689d3feca4f760f91e0fde084f37f2cd /app
parent5b73e0eb35f5b9b78c228a4867ef78538ef05653 (diff)
downloadgitlab-ce-9abbe3cc860f5838df76405e59830efdacb07047.tar.gz
Change issue show page to group MRs by projects and namespaces
Closes #26466.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/issues_controller.rb3
-rw-r--r--app/services/issues/fetch_referenced_merge_requests_service.rb12
2 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 384f18b316c..85c73b55f9f 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -121,8 +121,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