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
9ad67dc2
Unverified
Commit
9ad67dc2
authored
Jul 06, 2021
by
Paul Kaplan
Committed by
GitHub
Jul 06, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5684 from LLK/release/2021-06-30
Develop release/2021-06-30
parents
61e66acc
e719d25e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
src/redux/studio-permissions.js
src/redux/studio-permissions.js
+4
-2
src/views/studio/modals/user-projects-tile.jsx
src/views/studio/modals/user-projects-tile.jsx
+1
-0
src/views/studio/studio-title.jsx
src/views/studio/studio-title.jsx
+3
-0
test/unit/redux/studio-permissions.test.js
test/unit/redux/studio-permissions.test.js
+2
-2
No files found.
src/redux/studio-permissions.js
View file @
9ad67dc2
...
...
@@ -8,7 +8,7 @@ const isCurator = state => state.studio.curator;
const
isManager
=
state
=>
state
.
studio
.
manager
||
isCreator
(
state
);
// Action-based permissions selectors
const
selectCanEditInfo
=
state
=>
!
selectIsMuted
(
state
)
&&
(
selectIsAdmin
(
state
)
||
is
Manage
r
(
state
));
const
selectCanEditInfo
=
state
=>
!
selectIsMuted
(
state
)
&&
(
selectIsAdmin
(
state
)
||
is
Creato
r
(
state
));
const
selectCanAddProjects
=
state
=>
!
selectIsMuted
(
state
)
&&
(
isManager
(
state
)
||
...
...
@@ -71,7 +71,9 @@ const selectCanRemoveProject = (state, creatorUsername, actorId) => {
};
// We should only show the mute errors to muted users who have any permissions related to the content
const
selectShowEditMuteError
=
state
=>
selectIsMuted
(
state
)
&&
(
isManager
(
state
)
||
selectIsAdmin
(
state
));
// TODO these duplicate the behavior embedded in the non-muted parts of the selectors above, it would be good
// to extract this.
const
selectShowEditMuteError
=
state
=>
selectIsMuted
(
state
)
&&
(
isCreator
(
state
)
||
selectIsAdmin
(
state
));
const
selectShowProjectMuteError
=
state
=>
selectIsMuted
(
state
)
&&
(
selectIsAdmin
(
state
)
||
isManager
(
state
)
||
...
...
src/views/studio/modals/user-projects-tile.jsx
View file @
9ad67dc2
...
...
@@ -10,6 +10,7 @@ const UserProjectsTile = ({id, title, image, inStudio, onAdd, onRemove}) => {
const
[
added
,
setAdded
]
=
useState
(
inStudio
);
const
{
errorAlert
}
=
useContext
(
AlertContext
);
const
toggle
=
()
=>
{
if
(
submitting
)
return
;
setSubmitting
(
true
);
const
adding
=
!
added
;
// for clarity, the current action is opposite of previous state
(
adding
?
onAdd
(
id
)
:
onRemove
(
id
))
...
...
src/views/studio/studio-title.jsx
View file @
9ad67dc2
...
...
@@ -23,6 +23,8 @@ const errorToMessageId = error => {
}
};
const
TITLE_MAX_LENGTH
=
52
;
const
StudioTitle
=
({
titleError
,
isFetching
,
isMutating
,
isMutedEditor
,
title
,
canEditInfo
,
handleUpdate
})
=>
{
...
...
@@ -52,6 +54,7 @@ const StudioTitle = ({
className=
{
classNames
(
'
inplace-textarea
'
,
fieldClassName
)
}
disabled=
{
isMutating
||
!
canEditInfo
||
isFetching
}
defaultValue=
{
title
}
maxLength=
{
TITLE_MAX_LENGTH
}
onKeyDown=
{
e
=>
e
.
key
===
'
Enter
'
&&
e
.
target
.
blur
()
}
onBlur=
{
e
=>
{
if
(
e
.
target
.
value
!==
title
)
handleUpdate
(
e
.
target
.
value
);
...
...
test/unit/redux/studio-permissions.test.js
View file @
9ad67dc2
...
...
@@ -89,7 +89,7 @@ describe('studio info', () => {
test
.
each
([
[
'
admin
'
,
true
],
[
'
curator
'
,
false
],
[
'
manager
'
,
tru
e
],
[
'
manager
'
,
fals
e
],
[
'
creator
'
,
true
],
[
'
logged in
'
,
false
],
[
'
unconfirmed
'
,
false
],
...
...
@@ -503,7 +503,7 @@ describe('studio mute errors', () => {
[
'
unconfirmed
'
,
false
],
[
'
logged out
'
,
false
],
// ['muted creator', true], // This one fails; not sure why
[
'
muted manager
'
,
tru
e
],
[
'
muted manager
'
,
fals
e
],
[
'
muted curator
'
,
false
],
[
'
muted logged in
'
,
false
]
])(
'
%s: %s
'
,
(
role
,
expected
)
=>
{
...
...
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