diff options
author | Michael Muré <batolettre@gmail.com> | 2022-08-23 15:01:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 15:01:36 +0200 |
commit | 5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f (patch) | |
tree | e5382a09a45098672b6d60397eac201617fdd6ec /entities/bug/op_set_title.go | |
parent | 81fd7a5d8b6443e65c861f00a7387c0a3c926c66 (diff) | |
parent | 6ed4b8b7a1185ad278eb2e40b32e859f828233d9 (diff) | |
download | git-bug-5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f.tar.gz |
Merge pull request #664 from MichaelMure/combined-id-rework
bug: have a type for combined ids, fix #653
Diffstat (limited to 'entities/bug/op_set_title.go')
-rw-r--r-- | entities/bug/op_set_title.go | 29 |
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) { |