From 45b04351d8d02e53b3401b0ee23f7cbe750b63cd Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 3 May 2021 11:45:15 +0200 Subject: bug: have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653 --- entities/bug/op_set_title.go | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'entities/bug/op_set_title.go') 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) { -- cgit