diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-01 02:15:40 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-01 02:17:06 +0200 |
commit | c875d40e631f83507b602807480be96dae05fc85 (patch) | |
tree | a81b0909eda009acb395d936d1e2bf09e03cff3a /bug | |
parent | 2f88c28c59ce0480e64dfba6d820dc6f7589a6cf (diff) | |
download | git-bug-c875d40e631f83507b602807480be96dae05fc85.tar.gz |
termui: add a view to display a bug
Diffstat (limited to 'bug')
-rw-r--r-- | bug/comment.go | 4 | ||||
-rw-r--r-- | bug/operations/create.go | 2 | ||||
-rw-r--r-- | bug/operations/create_test.go | 2 | ||||
-rw-r--r-- | bug/person.go | 4 | ||||
-rw-r--r-- | bug/snapshot.go | 10 |
5 files changed, 14 insertions, 8 deletions
diff --git a/bug/comment.go b/bug/comment.go index 9cc38738..c0c07076 100644 --- a/bug/comment.go +++ b/bug/comment.go @@ -6,8 +6,8 @@ import ( ) type Comment struct { - Author Person `json:"author"` - Message string `json:"message"` + Author Person + Message string // Creation time of the comment. // Should be used only for human display, never for ordering as we can't rely on it in a distributed system. diff --git a/bug/operations/create.go b/bug/operations/create.go index 4c1dd32e..0ee7e857 100644 --- a/bug/operations/create.go +++ b/bug/operations/create.go @@ -23,6 +23,8 @@ func (op CreateOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { UnixTime: op.UnixTime, }, } + snapshot.Author = op.Author + snapshot.CreatedAt = op.Time() return snapshot } diff --git a/bug/operations/create_test.go b/bug/operations/create_test.go index 8aade05f..11b907c8 100644 --- a/bug/operations/create_test.go +++ b/bug/operations/create_test.go @@ -23,6 +23,8 @@ func TestCreate(t *testing.T) { Comments: []bug.Comment{ {Author: rene, Message: "message", UnixTime: create.UnixTime}, }, + Author: rene, + CreatedAt: create.Time(), } if !reflect.DeepEqual(snapshot, expected) { diff --git a/bug/person.go b/bug/person.go index 6a70fa9e..5c9dcc4c 100644 --- a/bug/person.go +++ b/bug/person.go @@ -6,8 +6,8 @@ import ( ) type Person struct { - Name string `json:"name"` - Email string `json:"email"` + Name string + Email string } // GetUser will query the repository for user detail and build the corresponding Person diff --git a/bug/snapshot.go b/bug/snapshot.go index 5058b3f7..9001d2c7 100644 --- a/bug/snapshot.go +++ b/bug/snapshot.go @@ -10,10 +10,12 @@ import ( type Snapshot struct { id string - Status Status `json:"status"` - Title string `json:"title"` - Comments []Comment `json:"comments"` - Labels []Label `json:"labels"` + Status Status + Title string + Comments []Comment + Labels []Label + Author Person + CreatedAt time.Time Operations []Operation } |