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
83738de3
Commit
83738de3
authored
Apr 29, 2021
by
Eulyeon Ko
Committed by
Natalia Tepluhina
Apr 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix labels board scope config parsing in GraphQL boards [RUN AS-IF-FOSS]
parent
a32387e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
app/assets/javascripts/boards/filtered_search_boards.js
app/assets/javascripts/boards/filtered_search_boards.js
+4
-0
ee/app/assets/javascripts/boards/boards_util.js
ee/app/assets/javascripts/boards/boards_util.js
+1
-2
ee/spec/frontend/boards/boards_util_spec.js
ee/spec/frontend/boards/boards_util_spec.js
+3
-2
No files found.
app/assets/javascripts/boards/filtered_search_boards.js
View file @
83738de3
...
@@ -28,6 +28,10 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
...
@@ -28,6 +28,10 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
if
(
vuexstore
.
getters
.
shouldUseGraphQL
&&
vuexstore
.
state
.
boardConfig
)
{
if
(
vuexstore
.
getters
.
shouldUseGraphQL
&&
vuexstore
.
state
.
boardConfig
)
{
const
boardConfigPath
=
transformBoardConfig
(
vuexstore
.
state
.
boardConfig
);
const
boardConfigPath
=
transformBoardConfig
(
vuexstore
.
state
.
boardConfig
);
// TODO Refactor: https://gitlab.com/gitlab-org/gitlab/-/issues/329274
// here we are using "window.location.search" as a temporary store
// only to unpack the params and do another validation inside
// 'performSearch' and 'setFilter' vuex actions.
if
(
boardConfigPath
!==
''
)
{
if
(
boardConfigPath
!==
''
)
{
const
filterPath
=
window
.
location
.
search
?
`
${
window
.
location
.
search
}
&`
:
'
?
'
;
const
filterPath
=
window
.
location
.
search
?
`
${
window
.
location
.
search
}
&`
:
'
?
'
;
updateHistory
({
updateHistory
({
...
...
ee/app/assets/javascripts/boards/boards_util.js
View file @
83738de3
...
@@ -124,9 +124,8 @@ export function transformBoardConfig(boardConfig) {
...
@@ -124,9 +124,8 @@ export function transformBoardConfig(boardConfig) {
boardConfig
.
labels
.
forEach
((
label
)
=>
{
boardConfig
.
labels
.
forEach
((
label
)
=>
{
const
labelTitle
=
encodeURIComponent
(
label
.
title
);
const
labelTitle
=
encodeURIComponent
(
label
.
title
);
const
param
=
`label_name[]=
${
labelTitle
}
`
;
const
param
=
`label_name[]=
${
labelTitle
}
`
;
const
labelIndex
=
passedFilterParams
.
label_name
?.
indexOf
(
labelTitle
);
if
(
labelIndex
===
-
1
||
labelIndex
===
undefined
)
{
if
(
!
passedFilterParams
.
label_name
?.
includes
(
label
.
title
)
)
{
filterPath
.
push
(
param
);
filterPath
.
push
(
param
);
}
}
});
});
...
...
ee/spec/frontend/boards/boards_util_spec.js
View file @
83738de3
...
@@ -85,6 +85,7 @@ describe('transformBoardConfig', () => {
...
@@ -85,6 +85,7 @@ describe('transformBoardConfig', () => {
assigneeUsername
:
'
username
'
,
assigneeUsername
:
'
username
'
,
labels
:
[
labels
:
[
{
id
:
5
,
title
:
'
Deliverable
'
,
color
:
'
#34ebec
'
,
type
:
'
GroupLabel
'
,
textColor
:
'
#333333
'
},
{
id
:
5
,
title
:
'
Deliverable
'
,
color
:
'
#34ebec
'
,
type
:
'
GroupLabel
'
,
textColor
:
'
#333333
'
},
{
id
:
6
,
title
:
'
On hold
'
,
color
:
'
#34ebec
'
,
type
:
'
GroupLabel
'
,
textColor
:
'
#333333
'
},
],
],
weight
:
0
,
weight
:
0
,
};
};
...
@@ -94,12 +95,12 @@ describe('transformBoardConfig', () => {
...
@@ -94,12 +95,12 @@ describe('transformBoardConfig', () => {
const
result
=
transformBoardConfig
(
boardConfig
);
const
result
=
transformBoardConfig
(
boardConfig
);
expect
(
result
).
toContain
(
expect
(
result
).
toContain
(
'
milestone_title=milestone&weight=0&assignee_username=username&label_name[]=Deliverable
'
,
'
milestone_title=milestone&weight=0&assignee_username=username&label_name[]=Deliverable
&label_name[]=On%20hold
'
,
);
);
});
});
it
(
'
formats url parameters from boardConfig object preventing duplicates with passed filter query
'
,
()
=>
{
it
(
'
formats url parameters from boardConfig object preventing duplicates with passed filter query
'
,
()
=>
{
window
.
location
=
{
search
:
'
label_name[]=Deliverable
'
};
window
.
location
=
{
search
:
'
?label_name[]=Deliverable&label_name[]=On%20hold
'
};
const
result
=
transformBoardConfig
(
boardConfig
);
const
result
=
transformBoardConfig
(
boardConfig
);
expect
(
result
).
toContain
(
'
milestone_title=milestone&weight=0&assignee_username=username
'
);
expect
(
result
).
toContain
(
'
milestone_title=milestone&weight=0&assignee_username=username
'
);
...
...
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