Fix edited at bug

pull/12/head
Noah 2022-08-28 20:56:26 -07:00
parent aa8d719fc4
commit 8a36ea6d24
3 changed files with 7 additions and 2 deletions

View File

@ -102,6 +102,11 @@ func (c *Comment) Delete() 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
// MapCommentCounts collects total numbers of comments over a set of table IDs. Returns a

View File

@ -140,7 +140,7 @@
<div class="column content">
{{ToMarkdown .Message}}
{{if .UpdatedAt.After .CreatedAt}}
{{if .IsEdited}}
<div class="mt-4">
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>

View File

@ -224,7 +224,7 @@
<div class="column content">
{{ToMarkdown .Message}}
{{if .UpdatedAt.After .CreatedAt}}
{{if .IsEdited}}
<div class="mt-4">
<em title="{{.UpdatedAt.Format "2006-01-02 15:04:05"}}">
<small>Edited {{SincePrettyCoarse .UpdatedAt}} ago</small>