Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0e5dbaf8
Commit
0e5dbaf8
authored
Mar 21, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show system notes on commits in the MR page
parent
723f936f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
app/models/merge_request.rb
app/models/merge_request.rb
+10
-9
changelogs/unreleased/55268-exclude-system-notes-from-commits-in-mr.yml
...eleased/55268-exclude-system-notes-from-commits-in-mr.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+8
-0
No files found.
app/models/merge_request.rb
View file @
0e5dbaf8
...
@@ -858,15 +858,6 @@ class MergeRequest < ApplicationRecord
...
@@ -858,15 +858,6 @@ class MergeRequest < ApplicationRecord
end
end
def
related_notes
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
# 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
# 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
# used won't produce any duplicates (e.g. a note for a commit can't also be
...
@@ -878,6 +869,16 @@ class MergeRequest < ApplicationRecord
...
@@ -878,6 +869,16 @@ class MergeRequest < ApplicationRecord
alias_method
:discussion_notes
,
:related_notes
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?
def
mergeable_discussions_state?
return
true
unless
project
.
only_allow_merge_if_all_discussions_are_resolved?
return
true
unless
project
.
only_allow_merge_if_all_discussions_are_resolved?
...
...
changelogs/unreleased/55268-exclude-system-notes-from-commits-in-mr.yml
0 → 100644
View file @
0e5dbaf8
---
title
:
Exclude system notes from commits in merge request discussions
merge_request
:
26396
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
0e5dbaf8
...
@@ -805,6 +805,14 @@ describe MergeRequest do
...
@@ -805,6 +805,14 @@ describe MergeRequest do
expect
(
merge_request
.
commits
).
not_to
be_empty
expect
(
merge_request
.
commits
).
not_to
be_empty
expect
(
merge_request
.
related_notes
.
count
).
to
eq
(
3
)
expect
(
merge_request
.
related_notes
.
count
).
to
eq
(
3
)
end
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
end
describe
'#for_fork?'
do
describe
'#for_fork?'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment