aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/op_set_title.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_set_title.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_set_title.go')
-rw-r--r--entities/bug/op_set_title.go29
1 files changed, 18 insertions, 11 deletions
diff --git a/entities/bug/op_set_title.go b/entities/bug/op_set_title.go
index 75efd08e..e9526b64 100644
--- a/entities/bug/op_set_title.go
+++ b/entities/bug/op_set_title.go
@@ -28,12 +28,14 @@ func (op *SetTitleOperation) Apply(snapshot *Snapshot) {
snapshot.Title = op.Title
snapshot.addActor(op.Author())
+ id := op.Id()
item := &SetTitleTimelineItem{
- id: op.Id(),
- Author: op.Author(),
- UnixTime: timestamp.Timestamp(op.UnixTime),
- Title: op.Title,
- Was: op.Was,
+ id: id,
+ combinedId: entity.CombineIds(snapshot.Id(), id),
+ Author: op.Author(),
+ UnixTime: timestamp.Timestamp(op.UnixTime),
+ Title: op.Title,
+ Was: op.Was,
}
snapshot.Timeline = append(snapshot.Timeline, item)
@@ -68,19 +70,24 @@ func NewSetTitleOp(author identity.Interface, unixTime int64, title string, was
}
type SetTitleTimelineItem struct {
- id entity.Id
- Author identity.Interface
- UnixTime timestamp.Timestamp
- Title string
- Was string
+ id entity.Id
+ combinedId entity.CombinedId
+ Author identity.Interface
+ UnixTime timestamp.Timestamp
+ Title string
+ Was string
}
func (s SetTitleTimelineItem) Id() entity.Id {
return s.id
}
+func (s SetTitleTimelineItem) CombinedId() entity.CombinedId {
+ return s.combinedId
+}
+
// IsAuthored is a sign post method for gqlgen
-func (s SetTitleTimelineItem) IsAuthored() {}
+func (s *SetTitleTimelineItem) IsAuthored() {}
// SetTitle is a convenience function to change a bugs title
func SetTitle(b Interface, author identity.Interface, unixTime int64, title string, metadata map[string]string) (*SetTitleOperation, error) {