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
8267dcf1
Commit
8267dcf1
authored
Apr 02, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TODO and add selector for studio comment capability
parent
dc460fff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
src/redux/studio.js
src/redux/studio.js
+5
-1
src/views/studio/studio-comments.jsx
src/views/studio/studio-comments.jsx
+3
-3
test/unit/redux/studio.test.js
test/unit/redux/studio.test.js
+12
-1
No files found.
src/redux/studio.js
View file @
8267dcf1
...
...
@@ -133,6 +133,9 @@ const selectCanAddProjects = state =>
isCurator
(
state
)
||
(
selectIsSocial
(
state
)
&&
state
.
studio
.
openToAll
);
// This isn't "canComment" since they could be muted, but comment composer handles that
const
selectShowCommentComposer
=
state
=>
selectIsSocial
(
state
);
module
.
exports
=
{
getInitialState
,
studioReducer
,
...
...
@@ -144,5 +147,6 @@ module.exports = {
// Selectors
selectCanEditInfo
,
selectCanAddProjects
selectCanAddProjects
,
selectShowCommentComposer
};
src/views/studio/studio-comments.jsx
View file @
8267dcf1
...
...
@@ -9,6 +9,8 @@ import ComposeComment from '../preview/comment/compose-comment.jsx';
import
TopLevelComment
from
'
../preview/comment/top-level-comment.jsx
'
;
import
studioCommentActions
from
'
../../redux/studio-comment-actions.js
'
;
import
{
selectShowCommentComposer
}
from
'
../../redux/studio.js
'
;
const
StudioComments
=
({
comments
,
getTopLevelComments
,
...
...
@@ -81,9 +83,7 @@ export default connect(
comments
:
state
.
comments
.
comments
,
moreCommentsToLoad
:
state
.
comments
.
moreCommentsToLoad
,
replies
:
state
.
comments
.
replies
,
// TODO permissions like this to a selector for testing
shouldShowCommentComposer
:
!!
state
.
session
.
session
.
user
// is logged in
shouldShowCommentComposer
:
selectShowCommentComposer
(
state
)
}),
{
getTopLevelComments
:
studioCommentActions
.
getTopLevelComments
,
...
...
test/unit/redux/studio.test.js
View file @
8267dcf1
import
{
getInitialState
as
getInitialStudioState
,
selectCanEditInfo
,
selectCanAddProjects
selectCanAddProjects
,
selectShowCommentComposer
}
from
'
../../../src/redux/studio
'
;
import
{
...
...
@@ -75,4 +76,14 @@ describe('studio selectors', () => {
expect
(
selectCanAddProjects
(
state
)).
toBe
(
false
);
});
});
describe
(
'
studio comments
'
,
()
=>
{
test
(
'
show comment composer only for social users
'
,
()
=>
{
expect
(
selectShowCommentComposer
(
state
)).
toBe
(
false
);
state
.
session
=
sessions
.
user1
;
expect
(
selectShowCommentComposer
(
state
)).
toBe
(
false
);
state
.
session
=
sessions
.
user1Social
;
expect
(
selectShowCommentComposer
(
state
)).
toBe
(
true
);
});
});
});
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