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
9eb1bf9c
Commit
9eb1bf9c
authored
Sep 16, 2020
by
peterhegman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to using `gon.current_user_id`
Instead of parsing from `data-current-user-id`
parent
b88c1959
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
app/assets/javascripts/groups/members/index.js
app/assets/javascripts/groups/members/index.js
+2
-2
app/views/groups/group_members/index.html.haml
app/views/groups/group_members/index.html.haml
+1
-1
spec/frontend/groups/members/index_spec.js
spec/frontend/groups/members/index_spec.js
+5
-4
No files found.
app/assets/javascripts/groups/members/index.js
View file @
9eb1bf9c
...
...
@@ -11,13 +11,13 @@ export default el => {
Vue
.
use
(
Vuex
);
const
{
members
,
groupId
,
currentUserId
}
=
el
.
dataset
;
const
{
members
,
groupId
}
=
el
.
dataset
;
const
store
=
new
Vuex
.
Store
({
...
membersModule
({
members
:
convertObjectPropsToCamelCase
(
JSON
.
parse
(
members
),
{
deep
:
true
}),
sourceId
:
parseInt
(
groupId
,
10
),
currentUserId
:
currentUserId
?
parseInt
(
currentUserId
,
10
)
:
null
,
currentUserId
:
gon
.
current_user_id
||
null
,
}),
});
...
...
app/views/groups/group_members/index.html.haml
View file @
9eb1bf9c
...
...
@@ -4,7 +4,7 @@
-
show_access_requests
=
can_manage_members
&&
@requesters
.
exists?
-
invited_active
=
params
[
:search_invited
].
present?
||
params
[
:invited_members_page
].
present?
-
vue_members_list_enabled
=
Feature
.
enabled?
(
:vue_group_members_list
,
@group
)
-
data_attributes
=
{
group_id:
@group
.
id
,
current_user_id:
current_user
&
.
id
}
-
data_attributes
=
{
group_id:
@group
.
id
}
-
form_item_label_css_class
=
'label-bold gl-mr-2 gl-mb-0 gl-py-2 align-self-md-center'
...
...
spec/frontend/groups/members/index_spec.js
View file @
9eb1bf9c
...
...
@@ -16,9 +16,10 @@ describe('initGroupMembersApp', () => {
beforeEach
(()
=>
{
el
=
document
.
createElement
(
'
div
'
);
el
.
setAttribute
(
'
data-members
'
,
membersJsonString
);
el
.
setAttribute
(
'
data-current-user-id
'
,
'
123
'
);
el
.
setAttribute
(
'
data-group-id
'
,
'
234
'
);
window
.
gon
=
{
current_user_id
:
123
};
document
.
body
.
appendChild
(
el
);
});
...
...
@@ -36,15 +37,15 @@ describe('initGroupMembersApp', () => {
expect
(
wrapper
.
find
(
GroupMembersApp
).
exists
()).
toBe
(
true
);
});
it
(
'
parses and
sets `currentUserId` in Vuex store
'
,
()
=>
{
it
(
'
sets `currentUserId` in Vuex store
'
,
()
=>
{
setup
();
expect
(
vm
.
$store
.
state
.
currentUserId
).
toBe
(
123
);
});
describe
(
'
when `
data-current-user-
id` is not set (user is not logged in)
'
,
()
=>
{
describe
(
'
when `
gon.current_user_
id` is not set (user is not logged in)
'
,
()
=>
{
it
(
'
sets `currentUserId` as `null` in Vuex store
'
,
()
=>
{
el
.
removeAttribute
(
'
data-current-user-id
'
)
;
window
.
gon
=
{}
;
setup
();
expect
(
vm
.
$store
.
state
.
currentUserId
).
toBeNull
();
...
...
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