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
b1f7a2be
Unverified
Commit
b1f7a2be
authored
Nov 16, 2020
by
picklesrus
Committed by
GitHub
Nov 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4637 from picklesrus/use-minutes
Convert mute timestamp to always show in minutes.
parents
760e303d
0470e0e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
src/views/preview/comment/compose-comment.jsx
src/views/preview/comment/compose-comment.jsx
+8
-5
No files found.
src/views/preview/comment/compose-comment.jsx
View file @
b1f7a2be
...
...
@@ -111,6 +111,10 @@ class ComposeComment extends React.Component {
});
}
convertToMinutesFromNow
(
timeStampInSec
)
{
return
Math
.
ceil
(((
timeStampInSec
*
1000
)
-
Date
.
now
())
/
(
60
*
1000
));
}
handleMuteClose
()
{
this
.
setState
({
muteOpen
:
false
...
...
@@ -122,7 +126,6 @@ class ComposeComment extends React.Component {
muteOpen
:
true
});
}
shouldShowMuteModal
(
offensesList
)
{
// We should show the mute modal whne the user is newly muted or hasn't seen it for a while.
// We don't want to show it more than about once a week.
...
...
@@ -144,7 +147,7 @@ class ComposeComment extends React.Component {
}
const
mostRecent
=
offensesList
[
numOffenses
-
1
];
const
creationTimeMinutesAgo
=
(
Date
.
now
()
-
(
mostRecent
.
createdAt
*
1000
))
/
(
60
*
1000
);
const
creationTimeMinutesAgo
=
this
.
convertToMinutesFromNow
(
mostRecent
.
createdAt
);
return
creationTimeMinutesAgo
<
2
&&
numOffenses
===
1
;
}
...
...
@@ -165,9 +168,9 @@ class ComposeComment extends React.Component {
<
CommentingStatus
>
<
p
>
Scratch thinks your comment was disrespectful.
</
p
>
<
p
>
For the next
{
this
.
state
.
muteExpiresAt
}
you
For the next
{
this
.
convertToMinutesFromNow
(
this
.
state
.
muteExpiresAt
)
}
minutes
you
won
'
t be able to post comments.
Once
{
this
.
state
.
muteExpiresAt
}
have passed,
Once
{
this
.
convertToMinutesFromNow
(
this
.
state
.
muteExpiresAt
)
}
minutes
have passed,
you will be able to comment again.
</
p
>
<
p
className=
"bottom-text"
>
For more information,
...
...
@@ -248,7 +251,7 @@ class ComposeComment extends React.Component {
useStandardSizes
className=
"mod-mute"
shouldCloseOnOverlayClick=
{
false
}
timeMuted=
{
this
.
state
.
muteExpiresAt
}
timeMuted=
{
`${this.convertToMinutesFromNow(this.state.muteExpiresAt)} minutes`
}
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