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
94cb80a2
Commit
94cb80a2
authored
Apr 07, 2020
by
Laura Montemayor
Committed by
Paul Slaughter
Apr 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaces underscore with lodash in approvals
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28166
parent
626f1415
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
25 deletions
+22
-25
ee/app/assets/javascripts/approvals/components/approvers_select.vue
...ets/javascripts/approvals/components/approvers_select.vue
+7
-10
ee/app/assets/javascripts/approvals/components/branches_select.vue
...sets/javascripts/approvals/components/branches_select.vue
+2
-2
ee/app/assets/javascripts/approvals/components/modal_rule_remove.vue
...ts/javascripts/approvals/components/modal_rule_remove.vue
+2
-2
ee/app/assets/javascripts/approvals/components/rule_form.vue
ee/app/assets/javascripts/approvals/components/rule_form.vue
+3
-3
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/actions.js
...s/javascripts/approvals/stores/modules/mr_edit/actions.js
+5
-5
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/mutations.js
...javascripts/approvals/stores/modules/mr_edit/mutations.js
+2
-3
ee/spec/javascripts/approvals/components/approvers_select_spec.js
...javascripts/approvals/components/approvers_select_spec.js
+1
-0
No files found.
ee/app/assets/javascripts/approvals/components/approvers_select.vue
View file @
94cb80a2
<
script
>
import
$
from
'
jquery
'
;
import
'
select2/select2
'
;
import
_
from
'
underscore
'
;
import
{
escape
as
esc
,
debounce
}
from
'
lodash
'
;
import
Api
from
'
ee/api
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
TYPE_USER
,
TYPE_GROUP
}
from
'
../constants
'
;
...
...
@@ -12,7 +12,7 @@ function addType(type) {
}
function
formatSelection
(
group
)
{
return
_
.
escape
(
group
.
full_name
||
group
.
name
);
return
esc
(
group
.
full_name
||
group
.
name
);
}
function
formatResultUser
(
result
)
{
...
...
@@ -25,8 +25,8 @@ function formatResultUser(result) {
${
avatar
}
</div>
<div class="user-info">
<div class="user-name">
${
_
.
escape
(
name
)}
</div>
<div class="user-username">@
${
_
.
escape
(
username
)}
</div>
<div class="user-name">
${
esc
(
name
)}
</div>
<div class="user-username">@
${
esc
(
username
)}
</div>
</div>
</div>
`
;
...
...
@@ -42,8 +42,8 @@ function formatResultGroup(result) {
${
avatar
}
</div>
<div class="group-info">
<div class="group-name">
${
_
.
escape
(
fullName
)}
</div>
<div class="group-path">
${
_
.
escape
(
fullPath
)}
</div>
<div class="group-name">
${
esc
(
fullName
)}
</div>
<div class="group-path">
${
esc
(
fullPath
)}
</div>
</div>
</div>
`
;
...
...
@@ -105,10 +105,7 @@ export default {
closeOnSelect
:
false
,
formatResult
,
formatSelection
,
query
:
_
.
debounce
(
({
term
,
callback
})
=>
this
.
fetchGroupsAndUsers
(
term
).
then
(
callback
),
250
,
),
query
:
debounce
(({
term
,
callback
})
=>
this
.
fetchGroupsAndUsers
(
term
).
then
(
callback
),
250
),
id
:
({
type
,
id
})
=>
`
${
type
}${
id
}
`
,
})
.
on
(
'
change
'
,
e
=>
this
.
onChange
(
e
));
...
...
ee/app/assets/javascripts/approvals/components/branches_select.vue
View file @
94cb80a2
<
script
>
import
$
from
'
jquery
'
;
import
'
select2/select2
'
;
import
_
from
'
underscore
'
;
import
{
debounce
}
from
'
lodash
'
;
import
Api
from
'
ee/api
'
;
import
{
__
}
from
'
~/locale
'
;
...
...
@@ -62,7 +62,7 @@ export default {
formatResult
,
formatSelection
,
initSelection
:
(
element
,
callback
)
=>
this
.
initialOption
(
element
,
callback
),
query
:
_
.
debounce
(({
term
,
callback
})
=>
this
.
fetchBranches
(
term
).
then
(
callback
),
250
),
query
:
debounce
(({
term
,
callback
})
=>
this
.
fetchBranches
(
term
).
then
(
callback
),
250
),
id
:
({
type
,
id
})
=>
`
${
type
}${
id
}
`
,
})
.
on
(
'
change
'
,
e
=>
this
.
onChange
(
e
))
...
...
ee/app/assets/javascripts/approvals/components/modal_rule_remove.vue
View file @
94cb80a2
<
script
>
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
{
escape
as
esc
}
from
'
lodash
'
;
import
{
sprintf
,
n__
,
s__
}
from
'
~/locale
'
;
import
GlModalVuex
from
'
~/vue_shared/components/gl_modal_vuex.vue
'
;
...
...
@@ -33,7 +33,7 @@ export default {
'
ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{nMembers}.
'
,
),
{
name
:
`<strong>
${
_
.
escape
(
this
.
rule
.
name
)}
</strong>`
,
name
:
`<strong>
${
esc
(
this
.
rule
.
name
)}
</strong>`
,
nMembers
:
`<strong>
${
nMembers
}
</strong>`
,
},
false
,
...
...
ee/app/assets/javascripts/approvals/components/rule_form.vue
View file @
94cb80a2
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
{
groupBy
,
isNumber
}
from
'
lodash
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
ApproversList
from
'
./approvers_list.vue
'
;
...
...
@@ -49,7 +49,7 @@ export default {
computed
:
{
...
mapState
([
'
settings
'
]),
approversByType
()
{
return
_
.
groupBy
(
this
.
approvers
,
x
=>
x
.
type
);
return
groupBy
(
this
.
approvers
,
x
=>
x
.
type
);
},
users
()
{
return
this
.
approversByType
[
TYPE_USER
]
||
[];
...
...
@@ -88,7 +88,7 @@ export default {
return
!
this
.
name
?
__
(
'
Please provide a name
'
)
:
''
;
},
invalidApprovalsRequired
()
{
if
(
!
_
.
isNumber
(
this
.
approvalsRequired
))
{
if
(
!
isNumber
(
this
.
approvalsRequired
))
{
return
__
(
'
Please enter a valid number
'
);
}
...
...
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/actions.js
View file @
94cb80a2
import
_
from
'
underscore
'
;
import
{
memoize
,
uniqBy
,
uniqueId
,
flatten
}
from
'
lodash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
Api
from
'
~/api
'
;
...
...
@@ -7,15 +7,15 @@ import * as types from './mutation_types';
import
{
RULE_TYPE_ANY_APPROVER
}
from
'
../../../constants
'
;
import
{
mapMRApprovalSettingsResponse
}
from
'
../../../mappers
'
;
const
fetchGroupMembers
=
_
.
memoize
(
id
=>
Api
.
groupMembers
(
id
).
then
(
response
=>
response
.
data
));
const
fetchGroupMembers
=
memoize
(
id
=>
Api
.
groupMembers
(
id
).
then
(
response
=>
response
.
data
));
const
fetchApprovers
=
({
userRecords
,
groups
})
=>
{
const
groupUsersAsync
=
Promise
.
all
(
groups
.
map
(
fetchGroupMembers
));
return
groupUsersAsync
.
then
(
_
.
flatten
)
.
then
(
flatten
)
.
then
(
groupUsers
=>
groupUsers
.
concat
(
userRecords
))
.
then
(
users
=>
_
.
uniq
(
users
,
false
,
x
=>
x
.
id
));
.
then
(
users
=>
uniqBy
(
users
,
x
=>
x
.
id
));
};
const
seedApprovers
=
rule
=>
...
...
@@ -44,7 +44,7 @@ const seedNewRule = rule => {
...
rule
,
isNew
:
true
,
name
,
id
:
_
.
uniqueId
(
'
new
'
),
id
:
uniqueId
(
'
new
'
),
};
};
...
...
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/mutations.js
View file @
94cb80a2
import
_
from
'
underscore
'
;
import
base
from
'
../base/mutations
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
RULE_TYPE_ANY_APPROVER
}
from
'
../../../constants
'
;
...
...
@@ -6,7 +5,7 @@ import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
export
default
{
...
base
,
[
types
.
DELETE_RULE
](
state
,
id
)
{
const
idx
=
_
.
findIndex
(
state
.
rules
,
x
=>
x
.
id
===
id
);
const
idx
=
state
.
rules
.
findIndex
(
x
=>
x
.
id
===
id
);
if
(
idx
<
0
)
{
return
;
...
...
@@ -35,7 +34,7 @@ export default {
state
.
rules
=
[
newRule
];
},
[
types
.
PUT_RULE
](
state
,
{
id
,
...
newRule
})
{
const
idx
=
_
.
findIndex
(
state
.
rules
,
x
=>
x
.
id
===
id
);
const
idx
=
state
.
rules
.
findIndex
(
x
=>
x
.
id
===
id
);
if
(
idx
<
0
)
{
return
;
...
...
ee/spec/javascripts/approvals/components/approvers_select_spec.js
View file @
94cb80a2
...
...
@@ -68,6 +68,7 @@ describe('Approvals ApproversSelect', () => {
};
const
search
=
(
term
=
''
)
=>
{
$input
.
select2
(
'
search
'
,
term
);
jasmine
.
clock
().
mockDate
();
jasmine
.
clock
().
tick
(
DEBOUNCE_TIME
);
};
...
...
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