Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
ffe14754
Commit
ffe14754
authored
Aug 26, 2021
by
Eric Rosenbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reload the managers list after transfer
parent
13e3a540
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
src/views/studio/lib/studio-member-actions.js
src/views/studio/lib/studio-member-actions.js
+3
-2
src/views/studio/modals/transfer-host-confirmation.jsx
src/views/studio/modals/transfer-host-confirmation.jsx
+6
-2
test/unit/redux/studio-member-actions.test.js
test/unit/redux/studio-member-actions.test.js
+6
-0
No files found.
src/views/studio/lib/studio-member-actions.js
View file @
ffe14754
...
...
@@ -41,10 +41,10 @@ const normalizeError = (err, body, res) => {
return
null
;
};
const
loadManagers
=
()
=>
((
dispatch
,
getState
)
=>
{
const
loadManagers
=
(
reloadAll
=
false
)
=>
((
dispatch
,
getState
)
=>
{
const
state
=
getState
();
const
studioId
=
selectStudioId
(
state
);
const
managerCount
=
managers
.
selector
(
state
).
items
.
length
;
const
managerCount
=
reloadAll
?
0
:
managers
.
selector
(
state
).
items
.
length
;
const
opts
=
{
uri
:
`/studios/
${
studioId
}
/managers/`
,
params
:
{
limit
:
PER_PAGE_LIMIT
,
offset
:
managerCount
}
...
...
@@ -52,6 +52,7 @@ const loadManagers = () => ((dispatch, getState) => {
api
(
withAdmin
(
opts
,
state
),
(
err
,
body
,
res
)
=>
{
const
error
=
normalizeError
(
err
,
body
,
res
);
if
(
error
)
return
dispatch
(
managers
.
actions
.
error
(
error
));
if
(
reloadAll
)
dispatch
(
managers
.
actions
.
clear
());
dispatch
(
managers
.
actions
.
append
(
body
,
body
.
length
===
PER_PAGE_LIMIT
));
});
});
...
...
src/views/studio/modals/transfer-host-confirmation.jsx
View file @
ffe14754
...
...
@@ -13,7 +13,7 @@ import ValidationMessage from '../../../components/forms/validation-message.jsx'
import
{
managers
}
from
'
../lib/redux-modules
'
;
import
{
useAlertContext
}
from
'
../../../components/alert/alert-context
'
;
import
{
Errors
,
transferHost
}
from
'
../lib/studio-member-actions
'
;
import
{
Errors
,
transferHost
,
loadManagers
}
from
'
../lib/studio-member-actions
'
;
import
'
./transfer-host-modal.scss
'
;
...
...
@@ -21,6 +21,7 @@ const TransferHostConfirmation = ({
handleBack
,
handleClose
,
handleTransferHost
,
handleLoadManagers
,
intl
,
items
,
hostId
,
...
...
@@ -48,6 +49,7 @@ const TransferHostConfirmation = ({
handleTransferHost
(
passwordInputValue
,
newHostUsername
,
selectedId
)
.
then
(()
=>
{
handleClose
();
handleLoadManagers
(
true
);
// reload the list of managers, to get them in the correct order
successAlert
({
id
:
'
studio.alertTransfer
'
,
values
:
{
name
:
newHostUsername
}
...
...
@@ -176,6 +178,7 @@ TransferHostConfirmation.propTypes = {
})
})),
handleTransferHost
:
PropTypes
.
func
,
handleLoadManagers
:
PropTypes
.
func
,
selectedId
:
PropTypes
.
number
,
hostId
:
PropTypes
.
number
};
...
...
@@ -185,7 +188,8 @@ const connectedConfirmationStep = connect(
hostId
:
state
.
studio
.
owner
,
...
managers
.
selector
(
state
)
}),
{
handleTransferHost
:
transferHost
handleTransferHost
:
transferHost
,
handleLoadManagers
:
loadManagers
}
)(
TransferHostConfirmation
);
...
...
test/unit/redux/studio-member-actions.test.js
View file @
ffe14754
...
...
@@ -45,6 +45,12 @@ describe('loadManagers', () => {
expect
(
api
.
mock
.
calls
[
1
][
0
].
params
.
offset
).
toBe
(
3
);
items
=
managers
.
selector
(
store
.
getState
()).
items
;
expect
(
items
.
length
).
toBe
(
6
);
// Reload the list
store
.
dispatch
(
loadManagers
(
true
));
expect
(
api
.
mock
.
calls
[
2
][
0
].
params
.
offset
).
toBe
(
0
);
items
=
managers
.
selector
(
store
.
getState
()).
items
;
expect
(
items
.
length
).
toBe
(
3
);
});
test
(
'
it correctly uses the admin route when possible
'
,
()
=>
{
...
...
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