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
af070fb3
Commit
af070fb3
authored
Nov 13, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove approvals when in empty MR widget state
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/39009
parent
16eb31b1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
14 deletions
+80
-14
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+1
-1
changelogs/unreleased-ee/ee-39009-fix-approvals-showing-up-in-empty-mr-widget.yml
.../ee-39009-fix-approvals-showing-up-in-empty-mr-widget.yml
+5
-0
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+2
-2
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+1
-2
spec/javascripts/vue_mr_widget/ee_mr_widget_options_spec.js
spec/javascripts/vue_mr_widget/ee_mr_widget_options_spec.js
+60
-0
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+11
-9
No files found.
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
af070fb3
...
...
@@ -61,7 +61,7 @@ export default {
return
this
.
mr
.
hasCI
;
},
shouldRenderRelatedLinks
()
{
return
this
.
mr
.
relatedLinks
;
return
!!
this
.
mr
.
relatedLinks
;
},
shouldRenderDeployments
()
{
return
this
.
mr
.
deployments
.
length
;
...
...
changelogs/unreleased-ee/ee-39009-fix-approvals-showing-up-in-empty-mr-widget.yml
0 → 100644
View file @
af070fb3
---
title
:
Hide Approvals section when Merge Request Widget is showing the empty state
merge_request
:
3376
author
:
type
:
fixed
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
af070fb3
...
...
@@ -14,7 +14,7 @@ export default {
},
computed
:
{
shouldRenderApprovals
()
{
return
this
.
mr
.
approvalsRequired
;
return
this
.
mr
.
approvalsRequired
&&
this
.
mr
.
state
!==
'
nothingToMerge
'
;
},
shouldRenderCodeQuality
()
{
const
{
codeclimate
}
=
this
.
mr
;
...
...
@@ -35,7 +35,7 @@ export default {
:mr="mr"
:service="service" />
<mr-widget-approvals
v-if="
mr.approvalsRequired
"
v-if="
shouldRenderApprovals
"
:mr="mr"
:service="service" />
<mr-widget-code-quality
...
...
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
af070fb3
...
...
@@ -38,7 +38,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
isApproved
=
this
.
isApproved
||
false
;
this
.
approvals
=
this
.
approvals
||
null
;
this
.
approvalsPath
=
data
.
approvals_path
||
this
.
approvalsPath
;
this
.
approvalsRequired
=
Boolean
(
this
.
approvalsPath
);
this
.
approvalsRequired
=
data
.
approvalsRequired
||
Boolean
(
this
.
approvalsPath
);
}
setApprovals
(
data
)
{
...
...
@@ -91,4 +91,3 @@ export default class MergeRequestStore extends CEMergeRequestStore {
});
}
}
spec/javascripts/vue_mr_widget/ee_mr_widget_options_spec.js
0 → 100644
View file @
af070fb3
import
Vue
from
'
vue
'
;
import
mrWidgetOptionsEE
from
'
ee/vue_merge_request_widget/mr_widget_options
'
;
import
mockData
from
'
./mock_data
'
;
import
mountComponent
from
'
../helpers/vue_mount_component_helper
'
;
describe
(
'
EE mrWidgetOptions
'
,
()
=>
{
let
vm
;
let
MrWidgetOptions
;
beforeEach
(()
=>
{
// Prevent component mounting
delete
mrWidgetOptionsEE
.
extends
.
el
;
MrWidgetOptions
=
Vue
.
extend
(
mrWidgetOptionsEE
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
shouldRenderApprovals
'
,
()
=>
{
it
(
'
should return false when no approvals
'
,
()
=>
{
vm
=
mountComponent
(
MrWidgetOptions
,
{
mrData
:
{
...
mockData
,
approvalsRequired
:
false
,
},
});
vm
.
mr
.
state
=
'
readyToMerge
'
;
expect
(
vm
.
shouldRenderApprovals
).
toBeFalsy
();
});
it
(
'
should return false when in empty state
'
,
()
=>
{
vm
=
mountComponent
(
MrWidgetOptions
,
{
mrData
:
{
...
mockData
,
approvalsRequired
:
true
,
},
});
vm
.
mr
.
state
=
'
nothingToMerge
'
;
expect
(
vm
.
shouldRenderApprovals
).
toBeFalsy
();
});
it
(
'
should return true when requiring approvals and in non-empty state
'
,
()
=>
{
vm
=
mountComponent
(
MrWidgetOptions
,
{
mrData
:
{
...
mockData
,
approvalsRequired
:
true
,
},
});
vm
.
mr
.
state
=
'
readyToMerge
'
;
expect
(
vm
.
shouldRenderApprovals
).
toBeTruthy
();
});
});
});
});
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
View file @
af070fb3
...
...
@@ -3,13 +3,7 @@ import mrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options';
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
notify
from
'
~/lib/utils/notify
'
;
import
mockData
from
'
./mock_data
'
;
const
createComponent
=
()
=>
{
delete
mrWidgetOptions
.
el
;
// Prevent component mounting
gl
.
mrWidgetData
=
mockData
;
const
Component
=
Vue
.
extend
(
mrWidgetOptions
);
return
new
Component
();
};
import
mountComponent
from
'
../helpers/vue_mount_component_helper
'
;
const
returnPromise
=
data
=>
new
Promise
((
resolve
)
=>
{
resolve
({
...
...
@@ -22,9 +16,16 @@ const returnPromise = data => new Promise((resolve) => {
describe
(
'
mrWidgetOptions
'
,
()
=>
{
let
vm
;
let
MrWidgetOptions
;
beforeEach
(()
=>
{
vm
=
createComponent
();
// Prevent component mounting
delete
mrWidgetOptions
.
el
;
MrWidgetOptions
=
Vue
.
extend
(
mrWidgetOptions
);
vm
=
mountComponent
(
MrWidgetOptions
,
{
mrData
:
{
...
mockData
},
});
});
describe
(
'
data
'
,
()
=>
{
...
...
@@ -77,7 +78,8 @@ describe('mrWidgetOptions', () => {
});
it
(
'
should return true if there is relatedLinks in MR
'
,
()
=>
{
vm
.
mr
.
relatedLinks
=
{};
Vue
.
set
(
vm
.
mr
,
'
relatedLinks
'
,
{});
expect
(
vm
.
shouldRenderRelatedLinks
).
toBeTruthy
();
});
});
...
...
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