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
1196031b
Commit
1196031b
authored
Jul 28, 2020
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Commented by to MR widget
Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/10294
parent
bae811ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
10 deletions
+53
-10
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_list.vue
...ge_request_widget/components/approvals/approvals_list.vue
+18
-6
ee/spec/frontend/vue_mr_widget/components/approvals/approvals_list_spec.js
...vue_mr_widget/components/approvals/approvals_list_spec.js
+32
-4
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_list.vue
View file @
1196031b
...
@@ -92,11 +92,12 @@ export default {
...
@@ -92,11 +92,12 @@ export default {
<
template
>
<
template
>
<table
class=
"table m-0"
>
<table
class=
"table m-0"
>
<thead
class=
"thead-white text-nowrap"
>
<thead
class=
"thead-white text-nowrap"
>
<tr
class=
"d-none d-
sm
-table-row"
>
<tr
class=
"d-none d-
md
-table-row"
>
<th
class=
"w-0"
></th>
<th
class=
"w-0"
></th>
<th
class=
"w-25"
>
{{
s__
(
'
MRApprovals|Approvers
'
)
}}
</th>
<th
class=
"w-25"
>
{{
s__
(
'
MRApprovals|Approvers
'
)
}}
</th>
<th
class=
"w-50"
></th>
<th
class=
"w-50"
></th>
<th>
{{
s__
(
'
MRApprovals|Approvals
'
)
}}
</th>
<th>
{{
s__
(
'
MRApprovals|Approvals
'
)
}}
</th>
<th>
{{
s__
(
'
MRApprovals|Commented by
'
)
}}
</th>
<th>
{{
s__
(
'
MRApprovals|Approved by
'
)
}}
</th>
<th>
{{
s__
(
'
MRApprovals|Approved by
'
)
}}
</th>
</tr>
</tr>
</thead>
</thead>
...
@@ -110,7 +111,7 @@ export default {
...
@@ -110,7 +111,7 @@ export default {
<tr
v-for=
"rule in rules"
:key=
"rule.id"
>
<tr
v-for=
"rule in rules"
:key=
"rule.id"
>
<td
class=
"w-0"
><approved-icon
:is-approved=
"rule.approved"
/></td>
<td
class=
"w-0"
><approved-icon
:is-approved=
"rule.approved"
/></td>
<td
:colspan=
"rule.rule_type === $options.ruleTypeAnyApprover ? 2 : 1"
>
<td
:colspan=
"rule.rule_type === $options.ruleTypeAnyApprover ? 2 : 1"
>
<div
class=
"d-none d-
sm
-block js-name"
>
<div
class=
"d-none d-
md
-block js-name"
>
<empty-rule-name
<empty-rule-name
v-if=
"rule.rule_type === $options.ruleTypeAnyApprover"
v-if=
"rule.rule_type === $options.ruleTypeAnyApprover"
:eligible-approvers-docs-path=
"eligibleApproversDocsPath"
:eligible-approvers-docs-path=
"eligibleApproversDocsPath"
...
@@ -131,7 +132,7 @@ export default {
...
@@ -131,7 +132,7 @@ export default {
:security-approvals-help-page-path=
"securityApprovalsHelpPagePath"
:security-approvals-help-page-path=
"securityApprovalsHelpPagePath"
/>
/>
</div>
</div>
<div
class=
"d-flex d-
sm
-none flex-column js-summary"
>
<div
class=
"d-flex d-
md
-none flex-column js-summary"
>
<empty-rule-name
<empty-rule-name
v-if=
"rule.rule_type === $options.ruleTypeAnyApprover"
v-if=
"rule.rule_type === $options.ruleTypeAnyApprover"
:eligible-approvers-docs-path=
"eligibleApproversDocsPath"
:eligible-approvers-docs-path=
"eligibleApproversDocsPath"
...
@@ -144,6 +145,14 @@ export default {
...
@@ -144,6 +145,14 @@ export default {
:img-size=
"24"
:img-size=
"24"
empty-text=
""
empty-text=
""
/>
/>
<div
v-if=
"rule.commented_by.length > 0"
class=
"mt-2"
>
<span>
{{
s__
(
'
MRApprovals|Commented by
'
)
}}
</span>
<user-avatar-list
class=
"d-inline-block align-middle"
:items=
"rule.commented_by"
:img-size=
"24"
/>
</div>
<div
v-if=
"rule.approved_by.length"
class=
"mt-2"
>
<div
v-if=
"rule.approved_by.length"
class=
"mt-2"
>
<span>
{{
s__
(
'
MRApprovals|Approved by
'
)
}}
</span>
<span>
{{
s__
(
'
MRApprovals|Approved by
'
)
}}
</span>
<user-avatar-list
<user-avatar-list
...
@@ -156,14 +165,17 @@ export default {
...
@@ -156,14 +165,17 @@ export default {
</td>
</td>
<td
<td
v-if=
"rule.rule_type !== $options.ruleTypeAnyApprover"
v-if=
"rule.rule_type !== $options.ruleTypeAnyApprover"
class=
"d-none d-
sm
-table-cell js-approvers"
class=
"d-none d-
md
-table-cell js-approvers"
>
>
<div><user-avatar-list
:items=
"rule.approvers"
:img-size=
"24"
empty-text=
""
/></div>
<div><user-avatar-list
:items=
"rule.approvers"
:img-size=
"24"
empty-text=
""
/></div>
</td>
</td>
<td
class=
"w-0 d-none d-
sm
-table-cell text-nowrap js-pending"
>
<td
class=
"w-0 d-none d-
md
-table-cell text-nowrap js-pending"
>
{{
pendingApprovalsText
(
rule
)
}}
{{
pendingApprovalsText
(
rule
)
}}
</td>
</td>
<td
class=
"d-none d-sm-table-cell js-approved-by"
>
<td
class=
"d-none d-md-table-cell js-commented-by"
>
<user-avatar-list
:items=
"rule.commented_by"
:img-size=
"24"
empty-text=
""
/>
</td>
<td
class=
"d-none d-md-table-cell js-approved-by"
>
<user-avatar-list
:items=
"rule.approved_by"
:img-size=
"24"
empty-text=
""
/>
<user-avatar-list
:items=
"rule.approved_by"
:img-size=
"24"
empty-text=
""
/>
</td>
</td>
</tr>
</tr>
...
...
ee/spec/frontend/vue_mr_widget/components/approvals/approvals_list_spec.js
View file @
1196031b
...
@@ -9,6 +9,7 @@ const testRuleApproved = () => ({
...
@@ -9,6 +9,7 @@ const testRuleApproved = () => ({
name
:
'
Lorem
'
,
name
:
'
Lorem
'
,
approvals_required
:
2
,
approvals_required
:
2
,
approved_by
:
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
}],
approved_by
:
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
}],
commented_by
:
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
}],
approvers
:
testApprovers
(),
approvers
:
testApprovers
(),
approved
:
true
,
approved
:
true
,
});
});
...
@@ -17,6 +18,7 @@ const testRuleUnapproved = () => ({
...
@@ -17,6 +18,7 @@ const testRuleUnapproved = () => ({
name
:
'
Ipsum
'
,
name
:
'
Ipsum
'
,
approvals_required
:
1
,
approvals_required
:
1
,
approved_by
:
[],
approved_by
:
[],
commented_by
:
[],
approvers
:
testApprovers
(),
approvers
:
testApprovers
(),
approved
:
false
,
approved
:
false
,
});
});
...
@@ -25,6 +27,7 @@ const testRuleOptional = () => ({
...
@@ -25,6 +27,7 @@ const testRuleOptional = () => ({
name
:
'
Dolar
'
,
name
:
'
Dolar
'
,
approvals_required
:
0
,
approvals_required
:
0
,
approved_by
:
[{
id
:
1
}],
approved_by
:
[{
id
:
1
}],
commented_by
:
[{
id
:
1
}],
approvers
:
testApprovers
(),
approvers
:
testApprovers
(),
approved
:
false
,
approved
:
false
,
});
});
...
@@ -35,6 +38,7 @@ const testRuleFallback = () => ({
...
@@ -35,6 +38,7 @@ const testRuleFallback = () => ({
rule_type
:
'
any_approver
'
,
rule_type
:
'
any_approver
'
,
approvals_required
:
3
,
approvals_required
:
3
,
approved_by
:
[{
id
:
1
},
{
id
:
2
}],
approved_by
:
[{
id
:
1
},
{
id
:
2
}],
commented_by
:
[{
id
:
1
},
{
id
:
2
}],
approvers
:
[],
approvers
:
[],
approved
:
false
,
approved
:
false
,
});
});
...
@@ -44,6 +48,7 @@ const testRuleCodeOwner = () => ({
...
@@ -44,6 +48,7 @@ const testRuleCodeOwner = () => ({
fallback
:
true
,
fallback
:
true
,
approvals_required
:
3
,
approvals_required
:
3
,
approved_by
:
[{
id
:
1
},
{
id
:
2
}],
approved_by
:
[{
id
:
1
},
{
id
:
2
}],
commented_by
:
[{
id
:
1
},
{
id
:
2
}],
approvers
:
[],
approvers
:
[],
approved
:
false
,
approved
:
false
,
rule_type
:
'
code_owner
'
,
rule_type
:
'
code_owner
'
,
...
@@ -165,6 +170,18 @@ describe('EE MRWidget approvals list', () => {
...
@@ -165,6 +170,18 @@ describe('EE MRWidget approvals list', () => {
);
);
});
});
it
(
'
renders commented by user avatar list
'
,
()
=>
{
const
commentedRow
=
findRowElement
(
row
,
'
commented-by
'
);
const
commentedBy
=
commentedRow
.
find
(
UserAvatarList
);
expect
(
commentedBy
.
props
()).
toEqual
(
expect
.
objectContaining
({
items
:
rule
.
commented_by
,
emptyText
:
''
,
}),
);
});
describe
(
'
summary text
'
,
()
=>
{
describe
(
'
summary text
'
,
()
=>
{
let
summary
;
let
summary
;
...
@@ -191,10 +208,20 @@ describe('EE MRWidget approvals list', () => {
...
@@ -191,10 +208,20 @@ describe('EE MRWidget approvals list', () => {
);
);
});
});
it
(
'
renders commented by list
'
,
()
=>
{
const
commentedBy
=
summary
.
findAll
(
UserAvatarList
).
at
(
1
);
expect
(
commentedBy
.
exists
()).
toBe
(
true
);
expect
(
commentedBy
.
props
()).
toEqual
(
expect
.
objectContaining
({
items
:
rule
.
commented_by
,
}),
);
});
it
(
'
renders approved by list
'
,
()
=>
{
it
(
'
renders approved by list
'
,
()
=>
{
const
approvedBy
=
summary
.
findAll
(
UserAvatarList
).
at
(
1
);
const
approvedBy
=
summary
.
findAll
(
UserAvatarList
).
at
(
2
);
expect
(
approvedBy
.
exists
()).
toBe
(
true
);
expect
(
approvedBy
.
props
()).
toEqual
(
expect
(
approvedBy
.
props
()).
toEqual
(
expect
.
objectContaining
({
expect
.
objectContaining
({
items
:
rule
.
approved_by
,
items
:
rule
.
approved_by
,
...
@@ -281,8 +308,9 @@ describe('EE MRWidget approvals list', () => {
...
@@ -281,8 +308,9 @@ describe('EE MRWidget approvals list', () => {
const
summary
=
findRowElement
(
row
,
'
summary
'
);
const
summary
=
findRowElement
(
row
,
'
summary
'
);
const
lists
=
summary
.
findAll
(
UserAvatarList
);
const
lists
=
summary
.
findAll
(
UserAvatarList
);
expect
(
lists
).
toHaveLength
(
1
);
expect
(
lists
).
toHaveLength
(
2
);
expect
(
lists
.
at
(
0
).
props
(
'
items
'
)).
toEqual
(
rule
.
approved_by
);
expect
(
lists
.
at
(
0
).
props
(
'
items
'
)).
toEqual
(
rule
.
commented_by
);
expect
(
lists
.
at
(
1
).
props
(
'
items
'
)).
toEqual
(
rule
.
approved_by
);
});
});
});
});
...
...
locale/gitlab.pot
View file @
1196031b
...
@@ -14507,6 +14507,9 @@ msgstr ""
...
@@ -14507,6 +14507,9 @@ msgstr ""
msgid "MRApprovals|Approvers"
msgid "MRApprovals|Approvers"
msgstr ""
msgstr ""
msgid "MRApprovals|Commented by"
msgstr ""
msgid "MRDiff|Show changes only"
msgid "MRDiff|Show changes only"
msgstr ""
msgstr ""
...
...
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