diff options
author | Rémy Coutable <remy@rymai.me> | 2019-04-03 12:45:31 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-04-03 12:45:31 +0300 |
commit | b1f9e05a73e256e24c9e71076e736b22a39e2960 (patch) | |
tree | ff4b02db50c388b8d30f3f95ce7facbd0f1526b7 /app/models | |
parent | 478077747da82a3dfaafbebc1797b26b965b030f (diff) | |
parent | 0e5dbaf87f4f6f511eee469139e57d896164846c (diff) |
Merge branch '55268-exclude-system-notes-from-commits-in-mr' into 'master'
Do not show system notes on commits in the MR page
Closes #55268
See merge request gitlab-org/gitlab-ce!26396
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/merge_request.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b780b67492f..458c57c1dc6 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -858,15 +858,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 @@ -878,6 +869,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? |