aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/op_create.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-05-03 11:45:15 +0200
committerMichael Muré <batolettre@gmail.com>2022-08-22 13:25:26 +0200
commit45b04351d8d02e53b3401b0ee23f7cbe750b63cd (patch)
tree59d203ef6c0f6a497b7074cd5617c8869cac3b14 /entities/bug/op_create.go
parent43026fc53669d462a60feec7d22aec090959be72 (diff)
downloadgit-bug-45b04351d8d02e53b3401b0ee23f7cbe750b63cd.tar.gz
bug: have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653
Diffstat (limited to 'entities/bug/op_create.go')
-rw-r--r--entities/bug/op_create.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/entities/bug/op_create.go b/entities/bug/op_create.go
index fdfa131b..2afea406 100644
--- a/entities/bug/op_create.go
+++ b/entities/bug/op_create.go
@@ -32,7 +32,9 @@ func (op *CreateOperation) Apply(snapshot *Snapshot) {
return
}
- snapshot.id = op.Id()
+ // the Id of the Bug/Snapshot is the Id of the first Operation: CreateOperation
+ opId := op.Id()
+ snapshot.id = opId
snapshot.addActor(op.Author())
snapshot.addParticipant(op.Author())
@@ -40,10 +42,11 @@ func (op *CreateOperation) Apply(snapshot *Snapshot) {
snapshot.Title = op.Title
comment := Comment{
- id: entity.CombineIds(snapshot.Id(), op.Id()),
- Message: op.Message,
- Author: op.Author(),
- UnixTime: timestamp.Timestamp(op.UnixTime),
+ combinedId: entity.CombineIds(snapshot.id, opId),
+ targetId: opId,
+ Message: op.Message,
+ Author: op.Author(),
+ unixTime: timestamp.Timestamp(op.UnixTime),
}
snapshot.Comments = []Comment{comment}