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
e23b27ab
Commit
e23b27ab
authored
Feb 10, 2021
by
seotts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send automod feedback to api
parent
a9412af9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
5 deletions
+40
-5
src/components/modal/mute/modal.jsx
src/components/modal/mute/modal.jsx
+33
-5
src/views/preview/comment/compose-comment.jsx
src/views/preview/comment/compose-comment.jsx
+7
-0
No files found.
src/components/modal/mute/modal.jsx
View file @
e23b27ab
...
...
@@ -14,6 +14,8 @@ const FeedbackForm = require('./feedback-form.jsx');
const
classNames
=
require
(
'
classnames
'
);
require
(
'
./modal.scss
'
);
const
api
=
require
(
'
../../../lib/api
'
);
const
steps
=
{
COMMENT_ISSUE
:
0
,
MUTE_INFO
:
1
,
...
...
@@ -59,9 +61,26 @@ class MuteModal extends React.Component {
}
handleFeedbackSubmit
(
feedback
)
{
/* eslint-disable no-console */
console
.
log
(
feedback
);
/* eslint-enable no-console */
api
({
uri
:
`/comments/feedback`
,
authentication
:
this
.
props
.
user
.
token
,
withCredentials
:
true
,
method
:
'
POST
'
,
useCsrf
:
true
,
json
:
{
timestamp
:
Date
.
now
(),
feedback
:
feedback
,
comment
:
this
.
props
.
commentContent
,
userId
:
this
.
props
.
user
.
id
,
language
:
window
.
_locale
,
typeOfMessage
:
this
.
props
.
muteModalMessages
.
name
}
},
(
err
,
body
,
res
)
=>
{
if
(
err
||
res
.
statusCode
!==
200
)
{
body
=
{
rejected
:
'
error
'
};
}
console
.
log
(
'
done
'
);
});
this
.
setState
({
step
:
steps
.
FEEDBACK_SENT
...
...
@@ -126,7 +145,7 @@ class MuteModal extends React.Component {
)}
}
/>
</
p
>
{
this
.
state
.
step
===
this
.
numSteps
?
feedbackPrompt
:
null
}
{
this
.
state
.
step
===
this
.
numSteps
&&
this
.
props
.
showFeedback
?
feedbackPrompt
:
null
}
</
MuteStep
>
<
MuteStep
bottomImg=
"/svgs/commenting/warning.svg"
...
...
@@ -232,16 +251,25 @@ class MuteModal extends React.Component {
}
MuteModal
.
propTypes
=
{
commentContent
:
PropTypes
.
string
,
intl
:
intlShape
,
muteModalMessages
:
PropTypes
.
shape
({
name
:
PropTypes
.
string
,
commentType
:
PropTypes
.
string
,
muteStepHeader
:
PropTypes
.
string
,
muteStepContent
:
PropTypes
.
array
}),
onRequestClose
:
PropTypes
.
func
,
showFeedback
:
PropTypes
.
bool
,
showWarning
:
PropTypes
.
bool
,
startStep
:
PropTypes
.
oneOf
(
Object
.
keys
(
steps
)),
timeMuted
:
PropTypes
.
string
timeMuted
:
PropTypes
.
string
,
user
:
PropTypes
.
shape
({
id
:
PropTypes
.
number
,
username
:
PropTypes
.
string
,
token
:
PropTypes
.
string
,
thumbnailUrl
:
PropTypes
.
string
})
};
MuteModal
.
steps
=
steps
;
module
.
exports
=
injectIntl
(
MuteModal
);
src/views/preview/comment/compose-comment.jsx
View file @
e23b27ab
...
...
@@ -207,21 +207,25 @@ class ComposeComment extends React.Component {
// If mute modals have more than one unique "step" we could pass an array of steps
const
messageInfo
=
{
pii
:
{
name
:
'
pii
'
,
commentType
:
'
comment.type.pii
'
,
muteStepHeader
:
'
comment.pii.header
'
,
muteStepContent
:
[
'
comment.pii.content1
'
,
'
comment.pii.content2
'
,
'
comment.pii.content3
'
]
},
unconstructive
:
{
name
:
'
unconstructive
'
,
commentType
:
'
comment.type.unconstructive
'
,
muteStepHeader
:
'
comment.unconstructive.header
'
,
muteStepContent
:
[
'
comment.unconstructive.content1
'
,
'
comment.unconstructive.content2
'
]
},
vulgarity
:
{
name
:
'
vulgarity
'
,
commentType
:
'
comment.type.vulgarity
'
,
muteStepHeader
:
'
comment.vulgarity.header
'
,
muteStepContent
:
[
'
comment.vulgarity.content1
'
,
'
comment.vulgarity.content2
'
]
},
general
:
{
name
:
'
general
'
,
commentType
:
'
comment.type.general
'
,
muteStepHeader
:
'
comment.general.header
'
,
muteStepContent
:
[
'
comment.general.content1
'
]
...
...
@@ -356,11 +360,14 @@ class ComposeComment extends React.Component {
showCloseButton
useStandardSizes
className=
"mod-mute"
commentContent=
{
this
.
state
.
message
}
muteModalMessages=
{
this
.
getMuteMessageInfo
()
}
shouldCloseOnOverlayClick=
{
false
}
showFeedback=
{
this
.
state
.
status
===
ComposeStatus
.
REJECTED_MUTE
}
showWarning=
{
this
.
state
.
showWarning
}
startStep=
{
this
.
getMuteModalStartStep
()
}
timeMuted=
{
formatTime
.
formatRelativeTime
(
this
.
state
.
muteExpiresAtMs
,
window
.
_locale
)
}
user=
{
this
.
props
.
user
}
onRequestClose=
{
this
.
handleMuteClose
}
/>
)
:
null
}
...
...
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