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
3008d356
Commit
3008d356
authored
Jul 21, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incorrect selection checks
parent
68c94194
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
4 deletions
+48
-4
app/assets/javascripts/protected_branches/ee/constants.js
app/assets/javascripts/protected_branches/ee/constants.js
+6
-0
ee/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js
...ts/protected_branches/protected_branch_access_dropdown.js
+18
-2
ee/app/assets/javascripts/protected_tags/constants.js
ee/app/assets/javascripts/protected_tags/constants.js
+6
-0
ee/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
...vascripts/protected_tags/protected_tag_access_dropdown.js
+18
-2
No files found.
app/assets/javascripts/protected_branches/ee/constants.js
View file @
3008d356
...
...
@@ -9,4 +9,10 @@ export const LEVEL_TYPES = {
GROUP
:
'
group
'
,
};
export
const
LEVEL_ID_PROP
=
{
ROLE
:
'
access_level
'
,
USER
:
'
user_id
'
,
GROUP
:
'
group_id
'
,
};
export
const
ACCESS_LEVEL_NONE
=
0
;
ee/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js
View file @
3008d356
/* eslint-disable no-underscore-dangle, class-methods-use-this */
/* global Flash */
import
{
LEVEL_TYPES
,
ACCESS_LEVEL_NONE
}
from
'
./constants
'
;
import
{
LEVEL_TYPES
,
LEVEL_ID_PROP
,
ACCESS_LEVEL_NONE
}
from
'
./constants
'
;
export
default
class
ProtectedBranchAccessDropdown
{
constructor
(
options
)
{
...
...
@@ -150,8 +150,24 @@ export default class ProtectedBranchAccessDropdown {
let
index
=
-
1
;
const
selectedItems
=
this
.
getAllSelectedItems
();
// Compare IDs based on selectedItem.type
selectedItems
.
forEach
((
item
,
i
)
=>
{
if
(
selectedItem
.
id
===
item
.
access_level
)
{
let
comparator
;
switch
(
selectedItem
.
type
)
{
case
LEVEL_TYPES
.
ROLE
:
comparator
=
LEVEL_ID_PROP
.
ROLE
;
break
;
case
LEVEL_TYPES
.
GROUP
:
comparator
=
LEVEL_ID_PROP
.
GROUP
;
break
;
case
LEVEL_TYPES
.
USER
:
comparator
=
LEVEL_ID_PROP
.
USER
;
break
;
default
:
break
;
}
if
(
selectedItem
.
id
===
item
[
comparator
])
{
index
=
i
;
}
});
...
...
ee/app/assets/javascripts/protected_tags/constants.js
View file @
3008d356
...
...
@@ -8,4 +8,10 @@ export const LEVEL_TYPES = {
GROUP
:
'
group
'
,
};
export
const
LEVEL_ID_PROP
=
{
ROLE
:
'
access_level
'
,
USER
:
'
user_id
'
,
GROUP
:
'
group_id
'
,
};
export
const
ACCESS_LEVEL_NONE
=
0
;
ee/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
View file @
3008d356
/* eslint-disable no-underscore-dangle, class-methods-use-this */
/* global Flash */
import
{
LEVEL_TYPES
,
ACCESS_LEVEL_NONE
}
from
'
./constants
'
;
import
{
LEVEL_TYPES
,
LEVEL_ID_PROP
,
ACCESS_LEVEL_NONE
}
from
'
./constants
'
;
export
default
class
ProtectedTagAccessDropdown
{
constructor
(
options
)
{
...
...
@@ -145,8 +145,24 @@ export default class ProtectedTagAccessDropdown {
let
index
=
-
1
;
const
selectedItems
=
this
.
getAllSelectedItems
();
// Compare IDs based on selectedItem.type
selectedItems
.
forEach
((
item
,
i
)
=>
{
if
(
selectedItem
.
id
===
item
.
access_level
)
{
let
comparator
;
switch
(
selectedItem
.
type
)
{
case
LEVEL_TYPES
.
ROLE
:
comparator
=
LEVEL_ID_PROP
.
ROLE
;
break
;
case
LEVEL_TYPES
.
GROUP
:
comparator
=
LEVEL_ID_PROP
.
GROUP
;
break
;
case
LEVEL_TYPES
.
USER
:
comparator
=
LEVEL_ID_PROP
.
USER
;
break
;
default
:
break
;
}
if
(
selectedItem
.
id
===
item
[
comparator
])
{
index
=
i
;
}
});
...
...
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