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
d23866a9
Commit
d23866a9
authored
Nov 15, 2021
by
sstern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loading authors in issues list
Changelog: fixed
parent
f81066dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue
...ed/components/filtered_search_bar/tokens/author_token.vue
+5
-3
spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js
...omponents/filtered_search_bar/tokens/author_token_spec.js
+29
-0
No files found.
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue
View file @
d23866a9
<
script
>
import
{
GlAvatar
,
GlFilteredSearchSuggestion
}
from
'
@gitlab/ui
'
;
import
{
compact
}
from
'
lodash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
...
...
@@ -59,8 +59,10 @@ export default {
.
then
((
res
)
=>
{
// We'd want to avoid doing this check but
// users.json and /groups/:id/members & /projects/:id/users
// return response differently.
this
.
authors
=
Array
.
isArray
(
res
)
?
res
:
res
.
data
;
// return response differently
// TODO: rm when completed https://gitlab.com/gitlab-org/gitlab/-/issues/345756
this
.
authors
=
Array
.
isArray
(
res
)
?
compact
(
res
)
:
compact
(
res
.
data
);
})
.
catch
(()
=>
createFlash
({
...
...
spec/frontend/vue_shared/components/filtered_search_bar/tokens/author_token_spec.js
View file @
d23866a9
...
...
@@ -112,6 +112,35 @@ describe('AuthorToken', () => {
});
});
// TODO: rm when completed https://gitlab.com/gitlab-org/gitlab/-/issues/345756
describe
(
'
when there are null users presents
'
,
()
=>
{
const
mockAuthorsWithNullUser
=
mockAuthors
.
concat
([
null
]);
beforeEach
(()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
config
,
'
fetchAuthors
'
)
.
mockResolvedValue
({
data
:
mockAuthorsWithNullUser
});
getBaseToken
().
vm
.
$emit
(
'
fetch-suggestions
'
,
'
root
'
);
});
describe
(
'
when res.data is present
'
,
()
=>
{
it
(
'
filters the successful response when null values are present
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
getBaseToken
().
props
(
'
suggestions
'
)).
toEqual
(
mockAuthors
);
});
});
});
describe
(
'
when response is an array
'
,
()
=>
{
it
(
'
filters the successful response when null values are present
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
getBaseToken
().
props
(
'
suggestions
'
)).
toEqual
(
mockAuthors
);
});
});
});
});
it
(
'
calls `createFlash` with flash error message when request fails
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
config
,
'
fetchAuthors
'
).
mockRejectedValue
({});
...
...
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