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
b2f03880
Commit
b2f03880
authored
Nov 19, 2020
by
Scott Stern
Committed by
Nicolò Maria Mezzopera
Nov 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assign self to group boards sidebar
parent
a42447df
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
9 deletions
+69
-9
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
...javascripts/boards/components/board_assignee_dropdown.vue
+14
-2
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/actions.js
+5
-1
app/assets/javascripts/sidebar/components/assignees/issuable_assignees.vue
...ripts/sidebar/components/assignees/issuable_assignees.vue
+11
-3
changelogs/unreleased/ss-assign-self.yml
changelogs/unreleased/ss-assign-self.yml
+5
-0
spec/frontend/boards/components/board_assignee_dropdown_spec.js
...rontend/boards/components/board_assignee_dropdown_spec.js
+24
-1
spec/frontend/sidebar/issuable_assignees_spec.js
spec/frontend/sidebar/issuable_assignees_spec.js
+10
-2
No files found.
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
View file @
b2f03880
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
cloneDeep
}
from
'
lodash
'
;
import
{
import
{
GlDropdownItem
,
GlDropdownItem
,
GlDropdownDivider
,
GlDropdownDivider
,
...
@@ -37,7 +38,7 @@ export default {
...
@@ -37,7 +38,7 @@ export default {
return
{
return
{
search
:
''
,
search
:
''
,
participants
:
[],
participants
:
[],
selected
:
this
.
$store
.
getters
.
activeIssue
.
assignees
,
selected
:
[]
,
};
};
},
},
apollo
:
{
apollo
:
{
...
@@ -89,9 +90,20 @@ export default {
...
@@ -89,9 +90,20 @@ export default {
isSearchEmpty
()
{
isSearchEmpty
()
{
return
this
.
search
===
''
;
return
this
.
search
===
''
;
},
},
currentUser
()
{
return
gon
?.
current_username
;
},
},
created
()
{
this
.
selected
=
cloneDeep
(
this
.
activeIssue
.
assignees
);
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
setAssignees
'
]),
...
mapActions
([
'
setAssignees
'
]),
async
assignSelf
()
{
const
[
currentUserObject
]
=
await
this
.
setAssignees
(
this
.
currentUser
);
this
.
selectAssignee
(
currentUserObject
);
},
clearSelected
()
{
clearSelected
()
{
this
.
selected
=
[];
this
.
selected
=
[];
},
},
...
@@ -119,7 +131,7 @@ export default {
...
@@ -119,7 +131,7 @@ export default {
<
template
>
<
template
>
<board-editable-item
:title=
"assigneeText"
@
close=
"saveAssignees"
>
<board-editable-item
:title=
"assigneeText"
@
close=
"saveAssignees"
>
<template
#collapsed
>
<template
#collapsed
>
<issuable-assignees
:users=
"
activeIssue.assignees
"
/>
<issuable-assignees
:users=
"
selected"
@
assign-self=
"assignSelf
"
/>
</
template
>
</
template
>
<
template
#default
>
<
template
#default
>
...
...
app/assets/javascripts/boards/stores/actions.js
View file @
b2f03880
...
@@ -325,11 +325,15 @@ export default {
...
@@ -325,11 +325,15 @@ export default {
},
},
})
})
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
const
{
nodes
}
=
data
.
issueSetAssignees
?.
issue
?.
assignees
||
[];
commit
(
'
UPDATE_ISSUE_BY_ID
'
,
{
commit
(
'
UPDATE_ISSUE_BY_ID
'
,
{
issueId
:
getters
.
activeIssue
.
id
,
issueId
:
getters
.
activeIssue
.
id
,
prop
:
'
assignees
'
,
prop
:
'
assignees
'
,
value
:
data
.
issueSetAssignees
.
issue
.
assignees
.
nodes
,
value
:
nodes
,
});
});
return
nodes
;
});
});
},
},
...
...
app/assets/javascripts/sidebar/components/assignees/issuable_assignees.vue
View file @
b2f03880
<
script
>
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
n__
}
from
'
~/locale
'
;
import
{
n__
}
from
'
~/locale
'
;
import
UncollapsedAssigneeList
from
'
~/sidebar/components/assignees/uncollapsed_assignee_list.vue
'
;
import
UncollapsedAssigneeList
from
'
~/sidebar/components/assignees/uncollapsed_assignee_list.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlButton
,
UncollapsedAssigneeList
,
UncollapsedAssigneeList
,
},
},
inject
:
[
'
rootPath
'
],
inject
:
[
'
rootPath
'
],
...
@@ -27,9 +29,15 @@ export default {
...
@@ -27,9 +29,15 @@ export default {
<
template
>
<
template
>
<div
class=
"gl-display-flex gl-flex-direction-column"
>
<div
class=
"gl-display-flex gl-flex-direction-column"
>
<div
v-if=
"emptyUsers"
data-testid=
"none"
>
<div
v-if=
"emptyUsers"
data-testid=
"none"
>
<span>
<span>
{{
__
(
'
None
'
)
}}
-
</span>
{{
__
(
'
None
'
)
}}
<gl-button
</span>
data-testid=
"assign-yourself"
category=
"tertiary"
variant=
"link"
@
click=
"$emit('assign-self')"
>
<span
class=
"gl-text-gray-400"
>
{{
__
(
'
assign yourself
'
)
}}
</span>
</gl-button>
</div>
</div>
<uncollapsed-assignee-list
v-else
:users=
"users"
:root-path=
"rootPath"
/>
<uncollapsed-assignee-list
v-else
:users=
"users"
:root-path=
"rootPath"
/>
</div>
</div>
...
...
changelogs/unreleased/ss-assign-self.yml
0 → 100644
View file @
b2f03880
---
title
:
Add assign self to group boards sidebar
merge_request
:
47705
author
:
type
:
added
spec/frontend/boards/components/board_assignee_dropdown_spec.js
View file @
b2f03880
...
@@ -20,6 +20,7 @@ describe('BoardCardAssigneeDropdown', () => {
...
@@ -20,6 +20,7 @@ describe('BoardCardAssigneeDropdown', () => {
let
fakeApollo
;
let
fakeApollo
;
let
getIssueParticipantsSpy
;
let
getIssueParticipantsSpy
;
let
getSearchUsersSpy
;
let
getSearchUsersSpy
;
let
dispatchSpy
;
const
iid
=
'
111
'
;
const
iid
=
'
111
'
;
const
activeIssueName
=
'
test
'
;
const
activeIssueName
=
'
test
'
;
...
@@ -91,10 +92,11 @@ describe('BoardCardAssigneeDropdown', () => {
...
@@ -91,10 +92,11 @@ describe('BoardCardAssigneeDropdown', () => {
},
},
};
};
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockResolvedValue
();
dispatchSpy
=
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockResolvedValue
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
window
.
gon
=
{};
jest
.
restoreAllMocks
();
jest
.
restoreAllMocks
();
});
});
...
@@ -305,4 +307,25 @@ describe('BoardCardAssigneeDropdown', () => {
...
@@ -305,4 +307,25 @@ describe('BoardCardAssigneeDropdown', () => {
expect
(
wrapper
.
find
(
GlSearchBoxByType
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlSearchBoxByType
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
when assign-self is emitted from IssuableAssignees
'
,
()
=>
{
const
currentUser
=
{
username
:
'
self
'
,
name
:
''
,
id
:
''
};
beforeEach
(()
=>
{
window
.
gon
=
{
current_username
:
currentUser
.
username
};
dispatchSpy
.
mockResolvedValue
([
currentUser
]);
createComponent
();
wrapper
.
find
(
IssuableAssignees
).
vm
.
$emit
(
'
assign-self
'
);
});
it
(
'
calls setAssignees with currentUser
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
setAssignees
'
,
currentUser
.
username
);
});
it
(
'
adds the user to the selected list
'
,
async
()
=>
{
expect
(
findByText
(
currentUser
.
username
).
exists
()).
toBe
(
true
);
});
});
});
});
spec/frontend/sidebar/issuable_assignees_spec.js
View file @
b2f03880
...
@@ -26,8 +26,8 @@ describe('IssuableAssignees', () => {
...
@@ -26,8 +26,8 @@ describe('IssuableAssignees', () => {
createComponent
();
createComponent
();
});
});
it
(
'
renders "None"
'
,
()
=>
{
it
(
'
renders "None
- assign yourself
"
'
,
()
=>
{
expect
(
findEmptyAssignee
().
text
()).
toBe
(
'
None
'
);
expect
(
findEmptyAssignee
().
text
()).
toBe
(
'
None
- assign yourself
'
);
});
});
});
});
...
@@ -38,4 +38,12 @@ describe('IssuableAssignees', () => {
...
@@ -38,4 +38,12 @@ describe('IssuableAssignees', () => {
expect
(
findUncollapsedAssigneeList
().
exists
()).
toBe
(
true
);
expect
(
findUncollapsedAssigneeList
().
exists
()).
toBe
(
true
);
});
});
});
});
describe
(
'
when clicking "assign yourself"
'
,
()
=>
{
it
(
'
emits "assign-self"
'
,
()
=>
{
createComponent
();
wrapper
.
find
(
'
[data-testid="assign-yourself"]
'
).
vm
.
$emit
(
'
click
'
);
expect
(
wrapper
.
emitted
(
'
assign-self
'
)).
toHaveLength
(
1
);
});
});
});
});
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