Fix edited at bug
This commit is contained in:
parent
aa8d719fc4
commit
8a36ea6d24
|
@ -102,6 +102,11 @@ func (c *Comment) Delete() error {
|
||||||
return DB.Delete(c).Error
|
return DB.Delete(c).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsEdited returns if a comment was reasonably edited after it was created.
|
||||||
|
func (c *Comment) IsEdited() bool {
|
||||||
|
return c.UpdatedAt.Sub(c.CreatedAt) > 5*time.Second
|
||||||
|
}
|
||||||
|
|
||||||
type CommentCountMap map[uint64]int64
|
type CommentCountMap map[uint64]int64
|
||||||
|
|
||||||
// MapCommentCounts collects total numbers of comments over a set of table IDs. Returns a
|
// MapCommentCounts collects total numbers of comments over a set of table IDs. Returns a
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
<div class="column content">
|
<div class="column content">
|
||||||
{{ToMarkdown .Message}}
|
{{ToMarkdown .Message}}
|
||||||
|
|
||||||
{{if .UpdatedAt.After .CreatedAt}}
|
{{if .IsEdited}}
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
|
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
|
||||||
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>
|
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>
|
||||||
|
|
|
@ -224,7 +224,7 @@
|
||||||
<div class="column content">
|
<div class="column content">
|
||||||
{{ToMarkdown .Message}}
|
{{ToMarkdown .Message}}
|
||||||
|
|
||||||
{{if .UpdatedAt.After .CreatedAt}}
|
{{if .IsEdited}}
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
|
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
|
||||||
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>
|
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user