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
2ac90315
Commit
2ac90315
authored
Oct 16, 2018
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use can prefix instead of undefined callback
parent
1965a122
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
src/views/preview/comment/comment.jsx
src/views/preview/comment/comment.jsx
+6
-4
src/views/preview/comment/top-level-comment.jsx
src/views/preview/comment/top-level-comment.jsx
+10
-5
src/views/preview/presentation.jsx
src/views/preview/presentation.jsx
+4
-1
src/views/preview/preview.jsx
src/views/preview/preview.jsx
+2
-1
No files found.
src/views/preview/comment/comment.jsx
View file @
2ac90315
...
@@ -85,8 +85,9 @@ class Comment extends React.Component {
...
@@ -85,8 +85,9 @@ class Comment extends React.Component {
render
()
{
render
()
{
const
{
const
{
author
,
author
,
deletabl
e
,
canDelet
e
,
canReply
,
canReply
,
canRestore
,
content
,
content
,
datetimeCreated
,
datetimeCreated
,
id
,
id
,
...
@@ -113,7 +114,7 @@ class Comment extends React.Component {
...
@@ -113,7 +114,7 @@ class Comment extends React.Component {
<
div
className=
"action-list"
>
<
div
className=
"action-list"
>
{
visible
?
(
{
visible
?
(
<
React
.
Fragment
>
<
React
.
Fragment
>
{
deletabl
e
?
(
{
canDelet
e
?
(
<
span
<
span
className=
"comment-delete"
className=
"comment-delete"
onClick=
{
this
.
handleDelete
}
onClick=
{
this
.
handleDelete
}
...
@@ -133,7 +134,7 @@ class Comment extends React.Component {
...
@@ -133,7 +134,7 @@ class Comment extends React.Component {
<
span
className=
"comment-visibility"
>
<
span
className=
"comment-visibility"
>
<
FormattedMessage
id=
{
`comments.status.${visibility}`
}
/>
<
FormattedMessage
id=
{
`comments.status.${visibility}`
}
/>
</
span
>
</
span
>
{
this
.
props
.
o
nRestore
&&
(
{
ca
nRestore
&&
(
<
span
<
span
className=
"comment-restore"
className=
"comment-restore"
onClick=
{
this
.
handleRestore
}
onClick=
{
this
.
handleRestore
}
...
@@ -212,10 +213,11 @@ Comment.propTypes = {
...
@@ -212,10 +213,11 @@ Comment.propTypes = {
image
:
PropTypes
.
string
,
image
:
PropTypes
.
string
,
username
:
PropTypes
.
string
username
:
PropTypes
.
string
}),
}),
canDelete
:
PropTypes
.
bool
,
canReply
:
PropTypes
.
bool
,
canReply
:
PropTypes
.
bool
,
canRestore
:
PropTypes
.
bool
,
content
:
PropTypes
.
string
,
content
:
PropTypes
.
string
,
datetimeCreated
:
PropTypes
.
string
,
datetimeCreated
:
PropTypes
.
string
,
deletable
:
PropTypes
.
bool
,
id
:
PropTypes
.
number
,
id
:
PropTypes
.
number
,
onAddComment
:
PropTypes
.
func
,
onAddComment
:
PropTypes
.
func
,
onDelete
:
PropTypes
.
func
,
onDelete
:
PropTypes
.
func
,
...
...
src/views/preview/comment/top-level-comment.jsx
View file @
2ac90315
...
@@ -53,10 +53,11 @@ class TopLevelComment extends React.Component {
...
@@ -53,10 +53,11 @@ class TopLevelComment extends React.Component {
render
()
{
render
()
{
const
{
const
{
author
,
author
,
canDelete
,
canReply
,
canReply
,
canRestore
,
content
,
content
,
datetimeCreated
,
datetimeCreated
,
deletable
,
id
,
id
,
onDelete
,
onDelete
,
onReport
,
onReport
,
...
@@ -66,7 +67,7 @@ class TopLevelComment extends React.Component {
...
@@ -66,7 +67,7 @@ class TopLevelComment extends React.Component {
visibility
visibility
}
=
this
.
props
;
}
=
this
.
props
;
const
canRestoreReplies
=
visibility
===
'
visible
'
;
const
parentVisible
=
visibility
===
'
visible
'
;
return
(
return
(
<
FlexRow
className=
"comment-container"
>
<
FlexRow
className=
"comment-container"
>
...
@@ -77,8 +78,9 @@ class TopLevelComment extends React.Component {
...
@@ -77,8 +78,9 @@ class TopLevelComment extends React.Component {
author
,
author
,
content
,
content
,
datetimeCreated
,
datetimeCreated
,
deletabl
e
,
canDelet
e
,
canReply
,
canReply
,
canRestore
,
id
,
id
,
onDelete
,
onDelete
,
onReport
,
onReport
,
...
@@ -98,10 +100,11 @@ class TopLevelComment extends React.Component {
...
@@ -98,10 +100,11 @@ class TopLevelComment extends React.Component {
{
(
this
.
state
.
expanded
?
replies
:
replies
.
slice
(
0
,
3
)).
map
(
reply
=>
(
{
(
this
.
state
.
expanded
?
replies
:
replies
.
slice
(
0
,
3
)).
map
(
reply
=>
(
<
Comment
<
Comment
author=
{
reply
.
author
}
author=
{
reply
.
author
}
canDelete=
{
canDelete
}
canReply=
{
canReply
}
canReply=
{
canReply
}
canRestore=
{
canRestore
&&
parentVisible
}
content=
{
reply
.
content
}
content=
{
reply
.
content
}
datetimeCreated=
{
reply
.
datetime_created
}
datetimeCreated=
{
reply
.
datetime_created
}
deletable=
{
deletable
}
id=
{
reply
.
id
}
id=
{
reply
.
id
}
key=
{
reply
.
id
}
key=
{
reply
.
id
}
projectId=
{
projectId
}
projectId=
{
projectId
}
...
@@ -109,7 +112,7 @@ class TopLevelComment extends React.Component {
...
@@ -109,7 +112,7 @@ class TopLevelComment extends React.Component {
onAddComment=
{
this
.
handleAddComment
}
onAddComment=
{
this
.
handleAddComment
}
onDelete=
{
this
.
handleDeleteReply
}
onDelete=
{
this
.
handleDeleteReply
}
onReport=
{
this
.
handleReportReply
}
onReport=
{
this
.
handleReportReply
}
onRestore=
{
canRestoreReplies
&&
this
.
handleRestoreReply
}
onRestore=
{
this
.
handleRestoreReply
}
/>
/>
))
}
))
}
</
FlexRow
>
</
FlexRow
>
...
@@ -138,7 +141,9 @@ TopLevelComment.propTypes = {
...
@@ -138,7 +141,9 @@ TopLevelComment.propTypes = {
image
:
PropTypes
.
string
,
image
:
PropTypes
.
string
,
username
:
PropTypes
.
string
username
:
PropTypes
.
string
}),
}),
canDelete
:
PropTypes
.
bool
,
canReply
:
PropTypes
.
bool
,
canReply
:
PropTypes
.
bool
,
canRestore
:
PropTypes
.
bool
,
content
:
PropTypes
.
string
,
content
:
PropTypes
.
string
,
datetimeCreated
:
PropTypes
.
string
,
datetimeCreated
:
PropTypes
.
string
,
deletable
:
PropTypes
.
bool
,
deletable
:
PropTypes
.
bool
,
...
...
src/views/preview/presentation.jsx
View file @
2ac90315
...
@@ -46,6 +46,7 @@ const PreviewPresentation = ({
...
@@ -46,6 +46,7 @@ const PreviewPresentation = ({
backpackOptions
,
backpackOptions
,
canAddToStudio
,
canAddToStudio
,
canReport
,
canReport
,
canRestoreComments
,
comments
,
comments
,
editable
,
editable
,
extensions
,
extensions
,
...
@@ -363,10 +364,11 @@ const PreviewPresentation = ({
...
@@ -363,10 +364,11 @@ const PreviewPresentation = ({
{
comments
.
map
(
comment
=>
(
{
comments
.
map
(
comment
=>
(
<
TopLevelComment
<
TopLevelComment
author=
{
comment
.
author
}
author=
{
comment
.
author
}
canDelete=
{
userOwnsProject
}
canReply=
{
isLoggedIn
&&
projectInfo
.
comments_allowed
}
canReply=
{
isLoggedIn
&&
projectInfo
.
comments_allowed
}
canRestore=
{
canRestoreComments
}
content=
{
comment
.
content
}
content=
{
comment
.
content
}
datetimeCreated=
{
comment
.
datetime_created
}
datetimeCreated=
{
comment
.
datetime_created
}
deletable=
{
userOwnsProject
}
id=
{
comment
.
id
}
id=
{
comment
.
id
}
key=
{
comment
.
id
}
key=
{
comment
.
id
}
parentId=
{
comment
.
parent_id
}
parentId=
{
comment
.
parent_id
}
...
@@ -411,6 +413,7 @@ PreviewPresentation.propTypes = {
...
@@ -411,6 +413,7 @@ PreviewPresentation.propTypes = {
}),
}),
canAddToStudio
:
PropTypes
.
bool
,
canAddToStudio
:
PropTypes
.
bool
,
canReport
:
PropTypes
.
bool
,
canReport
:
PropTypes
.
bool
,
canRestoreComments
:
PropTypes
.
bool
,
comments
:
PropTypes
.
arrayOf
(
PropTypes
.
object
),
comments
:
PropTypes
.
arrayOf
(
PropTypes
.
object
),
editable
:
PropTypes
.
bool
,
editable
:
PropTypes
.
bool
,
extensions
:
PropTypes
.
arrayOf
(
PropTypes
.
object
),
extensions
:
PropTypes
.
arrayOf
(
PropTypes
.
object
),
...
...
src/views/preview/preview.jsx
View file @
2ac90315
...
@@ -351,6 +351,7 @@ class Preview extends React.Component {
...
@@ -351,6 +351,7 @@ class Preview extends React.Component {
backpackOptions=
{
this
.
props
.
backpackOptions
}
backpackOptions=
{
this
.
props
.
backpackOptions
}
canAddToStudio=
{
this
.
props
.
canAddToStudio
}
canAddToStudio=
{
this
.
props
.
canAddToStudio
}
canReport=
{
this
.
props
.
canReport
}
canReport=
{
this
.
props
.
canReport
}
canRestoreComments=
{
this
.
props
.
isAdmin
}
comments=
{
this
.
props
.
comments
}
comments=
{
this
.
props
.
comments
}
editable=
{
this
.
props
.
isEditable
}
editable=
{
this
.
props
.
isEditable
}
extensions=
{
this
.
state
.
extensions
}
extensions=
{
this
.
state
.
extensions
}
...
@@ -383,7 +384,7 @@ class Preview extends React.Component {
...
@@ -383,7 +384,7 @@ class Preview extends React.Component {
onReportClose=
{
this
.
handleReportClose
}
onReportClose=
{
this
.
handleReportClose
}
onReportComment=
{
this
.
handleReportComment
}
onReportComment=
{
this
.
handleReportComment
}
onReportSubmit=
{
this
.
handleReportSubmit
}
onReportSubmit=
{
this
.
handleReportSubmit
}
onRestoreComment=
{
this
.
props
.
isAdmin
&&
this
.
handleRestoreComment
}
onRestoreComment=
{
this
.
handleRestoreComment
}
onSeeInside=
{
this
.
handleSeeInside
}
onSeeInside=
{
this
.
handleSeeInside
}
onShare=
{
this
.
handleShare
}
onShare=
{
this
.
handleShare
}
onToggleComments=
{
this
.
handleToggleComments
}
onToggleComments=
{
this
.
handleToggleComments
}
...
...
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