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
92f374a1
Commit
92f374a1
authored
Aug 12, 2020
by
Robert May
Committed by
Igor Drozdov
Aug 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data to commented_by
Adds a simple lookup for note authors who are approvers for an MR.
parent
d3936df4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
1 deletion
+20
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-0
ee/app/models/approval_wrapped_rule.rb
ee/app/models/approval_wrapped_rule.rb
+1
-1
ee/changelogs/unreleased/commented-by-3.yml
ee/changelogs/unreleased/commented-by-3.yml
+5
-0
ee/spec/models/approval_wrapped_rule_spec.rb
ee/spec/models/approval_wrapped_rule_spec.rb
+8
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+3
-0
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+1
-0
No files found.
app/models/concerns/issuable.rb
View file @
92f374a1
...
...
@@ -61,6 +61,8 @@ module Issuable
end
end
has_many
:note_authors
,
->
{
distinct
},
through: :notes
,
source: :author
has_many
:label_links
,
as: :target
,
dependent: :destroy
,
inverse_of: :target
# rubocop:disable Cop/ActiveRecordDependent
has_many
:labels
,
through: :label_links
has_many
:todos
,
as: :target
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
...
ee/app/models/approval_wrapped_rule.rb
View file @
92f374a1
...
...
@@ -76,7 +76,7 @@ class ApprovalWrappedRule
def
commented_approvers
strong_memoize
(
:commented_approvers
)
do
[]
merge_request
.
note_authors
&
approvers
end
end
...
...
ee/changelogs/unreleased/commented-by-3.yml
0 → 100644
View file @
92f374a1
---
title
:
Add commented_by to approval_settings endpoint
merge_request
:
39237
author
:
type
:
added
ee/spec/models/approval_wrapped_rule_spec.rb
View file @
92f374a1
...
...
@@ -139,9 +139,17 @@ RSpec.describe ApprovalWrappedRule do
end
describe
"#commented_approvers"
do
let
(
:rule
)
{
create
(
:approval_project_rule
,
project:
merge_request
.
project
,
approvals_required:
approvals_required
,
users:
[
approver1
,
approver3
])
}
it
"returns an array"
do
expect
(
subject
.
commented_approvers
).
to
be_an
(
Array
)
end
it
"returns an array of approvers who have commented"
do
create
(
:note
,
project:
merge_request
.
project
,
noteable:
merge_request
,
author:
approver1
)
expect
(
subject
.
commented_approvers
).
to
eq
([
approver1
])
end
end
describe
'#unactioned_approvers'
do
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
92f374a1
...
...
@@ -47,6 +47,7 @@ issues:
-
alert_management_alert
-
status_page_published_incident
-
namespace
-
note_authors
events
:
-
author
-
project
...
...
@@ -167,6 +168,7 @@ merge_requests:
-
deployments
-
user_mentions
-
system_note_metadata
-
note_authors
external_pull_requests
:
-
project
merge_request_diff
:
...
...
@@ -671,6 +673,7 @@ epic:
-
events
-
resource_label_events
-
user_mentions
-
note_authors
epic_issue
:
-
epic
-
issue
...
...
spec/models/concerns/issuable_spec.rb
View file @
92f374a1
...
...
@@ -17,6 +17,7 @@ RSpec.describe Issuable do
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:todos
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:labels
)
}
it
{
is_expected
.
to
have_many
(
:note_authors
).
through
(
:notes
)
}
context
'Notes'
do
let!
(
:note
)
{
create
(
:note
,
noteable:
issue
,
project:
issue
.
project
)
}
...
...
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