comment.go

 1package bug
 2
 3import (
 4	"github.com/MichaelMure/git-bug/identity"
 5	"github.com/MichaelMure/git-bug/util/git"
 6	"github.com/dustin/go-humanize"
 7)
 8
 9// Comment represent a comment in a Bug
10type Comment struct {
11	Author  identity.Interface
12	Message string
13	Files   []git.Hash
14
15	// Creation time of the comment.
16	// Should be used only for human display, never for ordering as we can't rely on it in a distributed system.
17	UnixTime Timestamp
18}
19
20// FormatTimeRel format the UnixTime of the comment for human consumption
21func (c Comment) FormatTimeRel() string {
22	return humanize.Time(c.UnixTime.Time())
23}
24
25func (c Comment) FormatTime() string {
26	return c.UnixTime.Time().Format("Mon Jan 2 15:04:05 2006 +0200")
27}
28
29// Sign post method for gqlgen
30func (c Comment) IsAuthored() {}