Commit a086aa81 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 5665fd9f e604344c
......@@ -860,15 +860,6 @@ class MergeRequest < ApplicationRecord
end
def related_notes
# Fetch comments only from last 100 commits
commits_for_notes_limit = 100
commit_ids = commit_shas.take(commits_for_notes_limit)
commit_notes = Note
.except(:order)
.where(project_id: [source_project_id, target_project_id])
.for_commit_id(commit_ids)
# We're using a UNION ALL here since this results in better performance
# compared to using OR statements. We're using UNION ALL since the queries
# used won't produce any duplicates (e.g. a note for a commit can't also be
......@@ -880,6 +871,16 @@ class MergeRequest < ApplicationRecord
alias_method :discussion_notes, :related_notes
def commit_notes
# Fetch comments only from last 100 commits
commit_ids = commit_shas.take(100)
Note
.user
.where(project_id: [source_project_id, target_project_id])
.for_commit_id(commit_ids)
end
def mergeable_discussions_state?
return true unless project.only_allow_merge_if_all_discussions_are_resolved?
......
---
title: Exclude system notes from commits in merge request discussions
merge_request: 26396
author:
type: fixed
......@@ -256,6 +256,8 @@ curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://git
## List runner's jobs
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15432) in GitLab 10.3.
List jobs that are being processed or were processed by specified Runner.
```
......
......@@ -806,6 +806,14 @@ describe MergeRequest do
expect(merge_request.commits).not_to be_empty
expect(merge_request.related_notes.count).to eq(3)
end
it "excludes system notes for commits" do
system_note = create(:note_on_commit, :system, commit_id: merge_request.commits.first.id,
project: merge_request.project)
expect(merge_request.related_notes.count).to eq(2)
expect(merge_request.related_notes).not_to include(system_note)
end
end
describe '#for_fork?' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment