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
17962dde
Commit
17962dde
authored
Feb 17, 2020
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project setting approval approval input in sequential order
- Debounce action call to not fire on every number change
parent
bfd6f39a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
changelogs/unreleased/37951-project-settings-required-approval-input-not-sequential-order.yml
...settings-required-approval-input-not-sequential-order.yml
+5
-0
ee/app/assets/javascripts/approvals/components/mr_edit/rule_input.vue
...s/javascripts/approvals/components/mr_edit/rule_input.vue
+8
-4
ee/spec/frontend/approvals/components/mr_edit/rule_input_spec.js
.../frontend/approvals/components/mr_edit/rule_input_spec.js
+11
-5
No files found.
changelogs/unreleased/37951-project-settings-required-approval-input-not-sequential-order.yml
0 → 100644
View file @
17962dde
---
title
:
Fix project setting approval input in non-sequential order
merge_request
:
25391
author
:
type
:
fixed
ee/app/assets/javascripts/approvals/components/mr_edit/rule_input.vue
View file @
17962dde
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
RULE_TYPE_ANY_APPROVER
}
from
'
../../constants
'
;
import
{
debounce
}
from
'
lodash
'
;
const
ANY_RULE_NAME
=
'
All Members
'
;
...
...
@@ -21,17 +22,20 @@ export default {
},
methods
:
{
...
mapActions
([
'
putRule
'
,
'
postRule
'
]),
onInputChange
(
event
)
{
onInputChange
:
debounce
(
function
debounceSearch
(
event
)
{
const
{
value
}
=
event
.
target
;
const
approvalsRequired
=
parseInt
(
value
,
10
);
if
(
this
.
rule
.
id
)
{
this
.
putRule
({
id
:
this
.
rule
.
id
,
approvalsRequired
:
Number
(
event
.
target
.
value
)
});
this
.
putRule
({
id
:
this
.
rule
.
id
,
approvalsRequired
});
}
else
{
this
.
postRule
({
name
:
ANY_RULE_NAME
,
ruleType
:
RULE_TYPE_ANY_APPROVER
,
approvalsRequired
:
Number
(
event
.
target
.
value
)
,
approvalsRequired
,
});
}
},
},
1000
),
},
};
</
script
>
...
...
ee/spec/frontend/approvals/components/mr_edit/rule_input_spec.js
View file @
17962dde
...
...
@@ -4,6 +4,8 @@ import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue';
import
MREditModule
from
'
ee/approvals/stores/modules/mr_edit
'
;
import
{
createStoreOptions
}
from
'
ee/approvals/stores
'
;
jest
.
mock
(
'
lodash/debounce
'
,
()
=>
jest
.
fn
(
fn
=>
fn
));
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
...
...
@@ -80,10 +82,14 @@ describe('Rule Input', () => {
wrapper
.
element
.
value
=
wrapper
.
props
().
rule
.
approvalsRequired
+
1
;
wrapper
.
trigger
(
'
input
'
);
expect
(
action
).
toHaveBeenCalledWith
(
expect
.
anything
(),
{
approvalsRequired
:
10
,
id
:
5
},
undefined
,
);
jest
.
runAllTimers
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
action
).
toHaveBeenCalledWith
(
expect
.
anything
(),
{
approvalsRequired
:
10
,
id
:
5
},
undefined
,
);
});
});
});
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