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
4f25a2ae
Commit
4f25a2ae
authored
Jun 09, 2021
by
seotts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t show errors for toggling openToAll or commentsAllowed
parent
91d66cd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
17 deletions
+11
-17
src/redux/studio-mutations.js
src/redux/studio-mutations.js
+5
-5
src/views/studio/studio-comments-allowed.jsx
src/views/studio/studio-comments-allowed.jsx
+3
-6
src/views/studio/studio-open-to-all.jsx
src/views/studio/studio-open-to-all.jsx
+3
-6
No files found.
src/redux/studio-mutations.js
View file @
4f25a2ae
...
...
@@ -90,9 +90,7 @@ const selectFollowingMutationError = state => state.studioMutations.mutationErro
const
selectIsMutatingImage
=
state
=>
state
.
studioMutations
.
isMutating
.
image
;
const
selectImageMutationError
=
state
=>
state
.
studioMutations
.
mutationErrors
.
image
;
const
selectIsMutatingOpenToAll
=
state
=>
state
.
studioMutations
.
isMutating
.
openToAll
;
const
selectOpenToAllMutationError
=
state
=>
state
.
studioMutations
.
mutationErrors
.
openToAll
;
const
selectIsMutatingCommentsAllowed
=
state
=>
state
.
studioMutations
.
isMutating
.
commentsAllowed
;
const
selectCommentsAllowedMutationError
=
state
=>
state
.
studioMutations
.
mutationErrors
.
commentsAllowed
;
// Thunks
/**
...
...
@@ -223,6 +221,8 @@ const mutateStudioCommentsAllowed = shouldAllow => ((dispatch, getState) => {
},
(
err
,
body
,
res
)
=>
{
const
error
=
normalizeError
(
err
,
body
,
res
);
const
wasAllowed
=
selectStudioCommentsAllowed
(
state
);
// eslint-disable-next-line no-console
console
.
error
(
`Error mutating commentsAllowed:
${
error
}
`
);
dispatch
(
completeMutation
(
'
commentsAllowed
'
,
error
?
wasAllowed
:
shouldAllow
,
error
));
});
});
...
...
@@ -239,6 +239,8 @@ const mutateStudioOpenToAll = shouldBeOpen => ((dispatch, getState) => {
},
(
err
,
body
,
res
)
=>
{
const
error
=
normalizeError
(
err
,
body
,
res
);
const
wasOpen
=
selectStudioOpenToAll
(
getState
());
// eslint-disable-next-line no-console
console
.
error
(
`Error mutating openToAll:
${
error
}
`
);
dispatch
(
completeMutation
(
'
openToAll
'
,
error
?
wasOpen
:
shouldBeOpen
,
error
));
});
});
...
...
@@ -266,7 +268,5 @@ module.exports = {
selectIsMutatingImage
,
selectImageMutationError
,
selectIsMutatingCommentsAllowed
,
selectCommentsAllowedMutationError
,
selectIsMutatingOpenToAll
,
selectOpenToAllMutationError
selectIsMutatingOpenToAll
};
src/views/studio/studio-comments-allowed.jsx
View file @
4f25a2ae
...
...
@@ -7,13 +7,13 @@ import classNames from 'classnames';
import
{
selectStudioCommentsAllowed
,
selectIsFetchingInfo
}
from
'
../../redux/studio
'
;
import
{
mutateStudioCommentsAllowed
,
selectIsMutatingCommentsAllowed
,
selectCommentsAllowedMutationError
mutateStudioCommentsAllowed
,
selectIsMutatingCommentsAllowed
}
from
'
../../redux/studio-mutations
'
;
import
ToggleSlider
from
'
../../components/forms/toggle-slider.jsx
'
;
const
StudioCommentsAllowed
=
({
commentsAllowedError
,
isFetching
,
isMutating
,
commentsAllowed
,
handleUpdate
isFetching
,
isMutating
,
commentsAllowed
,
handleUpdate
})
=>
(
<
div
>
{
isFetching
?
(
...
...
@@ -33,14 +33,12 @@ const StudioCommentsAllowed = ({
})
}
onChange=
{
e
=>
handleUpdate
(
e
.
target
.
checked
)
}
/>
{
commentsAllowedError
&&
<
div
>
Error mutating commentsAllowed:
{
commentsAllowedError
}
</
div
>
}
</
div
>
)
}
</
div
>
);
StudioCommentsAllowed
.
propTypes
=
{
commentsAllowedError
:
PropTypes
.
string
,
isFetching
:
PropTypes
.
bool
,
isMutating
:
PropTypes
.
bool
,
commentsAllowed
:
PropTypes
.
bool
,
...
...
@@ -51,8 +49,7 @@ export default connect(
state
=>
({
commentsAllowed
:
selectStudioCommentsAllowed
(
state
),
isFetching
:
selectIsFetchingInfo
(
state
),
isMutating
:
selectIsMutatingCommentsAllowed
(
state
),
commentsAllowedError
:
selectCommentsAllowedMutationError
(
state
)
isMutating
:
selectIsMutatingCommentsAllowed
(
state
)
}),
{
handleUpdate
:
mutateStudioCommentsAllowed
...
...
src/views/studio/studio-open-to-all.jsx
View file @
4f25a2ae
...
...
@@ -7,13 +7,13 @@ import classNames from 'classnames';
import
{
selectStudioOpenToAll
,
selectIsFetchingInfo
}
from
'
../../redux/studio
'
;
import
{
mutateStudioOpenToAll
,
selectIsMutatingOpenToAll
,
selectOpenToAllMutationError
mutateStudioOpenToAll
,
selectIsMutatingOpenToAll
}
from
'
../../redux/studio-mutations
'
;
import
ToggleSlider
from
'
../../components/forms/toggle-slider.jsx
'
;
const
StudioOpenToAll
=
({
openToAllError
,
isFetching
,
isMutating
,
openToAll
,
handleUpdate
isFetching
,
isMutating
,
openToAll
,
handleUpdate
})
=>
(
<
div
>
{
isFetching
?
(
...
...
@@ -29,14 +29,12 @@ const StudioOpenToAll = ({
})
}
onChange=
{
e
=>
handleUpdate
(
e
.
target
.
checked
)
}
/>
{
openToAllError
&&
<
div
>
Error mutating openToAll:
{
openToAllError
}
</
div
>
}
</
div
>
)
}
</
div
>
);
StudioOpenToAll
.
propTypes
=
{
openToAllError
:
PropTypes
.
string
,
isFetching
:
PropTypes
.
bool
,
isMutating
:
PropTypes
.
bool
,
openToAll
:
PropTypes
.
bool
,
...
...
@@ -47,8 +45,7 @@ export default connect(
state
=>
({
openToAll
:
selectStudioOpenToAll
(
state
),
isFetching
:
selectIsFetchingInfo
(
state
),
isMutating
:
selectIsMutatingOpenToAll
(
state
),
openToAllError
:
selectOpenToAllMutationError
(
state
)
isMutating
:
selectIsMutatingOpenToAll
(
state
)
}),
{
handleUpdate
:
mutateStudioOpenToAll
...
...
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