aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-01 02:15:40 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-01 02:17:06 +0200
commitc875d40e631f83507b602807480be96dae05fc85 (patch)
treea81b0909eda009acb395d936d1e2bf09e03cff3a /bug
parent2f88c28c59ce0480e64dfba6d820dc6f7589a6cf (diff)
downloadgit-bug-c875d40e631f83507b602807480be96dae05fc85.tar.gz
termui: add a view to display a bug
Diffstat (limited to 'bug')
-rw-r--r--bug/comment.go4
-rw-r--r--bug/operations/create.go2
-rw-r--r--bug/operations/create_test.go2
-rw-r--r--bug/person.go4
-rw-r--r--bug/snapshot.go10
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
}