diff --git a/pkg/models/comment.go b/pkg/models/comment.go index 756484f..d28dd70 100644 --- a/pkg/models/comment.go +++ b/pkg/models/comment.go @@ -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 diff --git a/web/templates/forum/thread.html b/web/templates/forum/thread.html index c287006..21cda95 100644 --- a/web/templates/forum/thread.html +++ b/web/templates/forum/thread.html @@ -140,7 +140,7 @@
{{ToMarkdown .Message}} - {{if .UpdatedAt.After .CreatedAt}} + {{if .IsEdited}}
Edited {{SincePrettyCoarse .UpdatedAt}} ago diff --git a/web/templates/photo/permalink.html b/web/templates/photo/permalink.html index f4adce9..3c2b3ed 100644 --- a/web/templates/photo/permalink.html +++ b/web/templates/photo/permalink.html @@ -224,7 +224,7 @@
{{ToMarkdown .Message}} - {{if .UpdatedAt.After .CreatedAt}} + {{if .IsEdited}}
Edited {{SincePrettyCoarse .UpdatedAt}} ago