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_label_change.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_label_change.go')
-rw-r--r-- | entities/bug/op_label_change.go | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/entities/bug/op_label_change.go b/entities/bug/op_label_change.go index 45441f7c..76b2ebef 100644 --- a/entities/bug/op_label_change.go +++ b/entities/bug/op_label_change.go @@ -59,12 +59,14 @@ AddLoop: return string(snapshot.Labels[i]) < string(snapshot.Labels[j]) }) + id := op.Id() item := &LabelChangeTimelineItem{ - id: op.Id(), - Author: op.Author(), - UnixTime: timestamp.Timestamp(op.UnixTime), - Added: op.Added, - Removed: op.Removed, + // id: id, + combinedId: entity.CombineIds(snapshot.Id(), id), + Author: op.Author(), + UnixTime: timestamp.Timestamp(op.UnixTime), + Added: op.Added, + Removed: op.Removed, } snapshot.Timeline = append(snapshot.Timeline, item) @@ -103,19 +105,20 @@ func NewLabelChangeOperation(author identity.Interface, unixTime int64, added, r } type LabelChangeTimelineItem struct { - id entity.Id - Author identity.Interface - UnixTime timestamp.Timestamp - Added []Label - Removed []Label + // id entity.Id + combinedId entity.CombinedId + Author identity.Interface + UnixTime timestamp.Timestamp + Added []Label + Removed []Label } -func (l LabelChangeTimelineItem) Id() entity.Id { - return l.id +func (l LabelChangeTimelineItem) CombinedId() entity.CombinedId { + return l.combinedId } // IsAuthored is a sign post method for gqlgen -func (l LabelChangeTimelineItem) IsAuthored() {} +func (l *LabelChangeTimelineItem) IsAuthored() {} // ChangeLabels is a convenience function to change labels on a bug func ChangeLabels(b Interface, author identity.Interface, unixTime int64, add, remove []string, metadata map[string]string) ([]LabelChangeResult, *LabelChangeOperation, error) { @@ -180,7 +183,7 @@ func ChangeLabels(b Interface, author identity.Interface, unixTime int64, add, r } // ForceChangeLabels is a convenience function to apply the operation -// The difference with ChangeLabels is that no checks of deduplications are done. You are entirely +// The difference with ChangeLabels is that no checks for deduplication are done. You are entirely // responsible for what you are doing. In the general case, you want to use ChangeLabels instead. // The intended use of this function is to allow importers to create legal but unexpected label changes, // like removing a label with no information of when it was added before. |