aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_set_status.go
diff options
context:
space:
mode:
Diffstat (limited to 'bug/op_set_status.go')
-rw-r--r--bug/op_set_status.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/bug/op_set_status.go b/bug/op_set_status.go
index cdfa25e7..7e9f4314 100644
--- a/bug/op_set_status.go
+++ b/bug/op_set_status.go
@@ -23,7 +23,22 @@ func (op *SetStatusOperation) Hash() (git.Hash, error) {
func (op *SetStatusOperation) Apply(snapshot *Snapshot) {
snapshot.Status = op.Status
- snapshot.Timeline = append(snapshot.Timeline, op)
+
+ hash, err := op.Hash()
+ if err != nil {
+ // Should never error unless a programming error happened
+ // (covered in OpBase.Validate())
+ panic(err)
+ }
+
+ item := &SetStatusTimelineItem{
+ hash: hash,
+ Author: op.Author,
+ UnixTime: Timestamp(op.UnixTime),
+ Status: op.Status,
+ }
+
+ snapshot.Timeline = append(snapshot.Timeline, item)
}
func (op *SetStatusOperation) Validate() error {
@@ -45,6 +60,17 @@ func NewSetStatusOp(author Person, unixTime int64, status Status) *SetStatusOper
}
}
+type SetStatusTimelineItem struct {
+ hash git.Hash
+ Author Person
+ UnixTime Timestamp
+ Status Status
+}
+
+func (s SetStatusTimelineItem) Hash() git.Hash {
+ return s.hash
+}
+
// Convenience function to apply the operation
func Open(b Interface, author Person, unixTime int64) error {
op := NewSetStatusOp(author, unixTime, OpenStatus)