diff options
author | Michael Muré <batolettre@gmail.com> | 2021-05-03 11:45:15 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-08-22 13:25:26 +0200 |
commit | 45b04351d8d02e53b3401b0ee23f7cbe750b63cd (patch) | |
tree | 59d203ef6c0f6a497b7074cd5617c8869cac3b14 /entities/bug/op_edit_comment.go | |
parent | 43026fc53669d462a60feec7d22aec090959be72 (diff) | |
download | git-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_edit_comment.go')
-rw-r--r-- | entities/bug/op_edit_comment.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/entities/bug/op_edit_comment.go b/entities/bug/op_edit_comment.go index 41079f45..b0897b0a 100644 --- a/entities/bug/op_edit_comment.go +++ b/entities/bug/op_edit_comment.go @@ -33,12 +33,12 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { // Todo: currently any message can be edited, even by a different author // crypto signature are needed. - // Recreate the Comment Id to match on - commentId := entity.CombineIds(snapshot.Id(), op.Target) + // Recreate the combined Id to match on + combinedId := entity.CombineIds(snapshot.Id(), op.Target) var target TimelineItem for i, item := range snapshot.Timeline { - if item.Id() == commentId { + if item.CombinedId() == combinedId { target = snapshot.Timeline[i] break } @@ -50,10 +50,11 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { } comment := Comment{ - id: commentId, - Message: op.Message, - Files: op.Files, - UnixTime: timestamp.Timestamp(op.UnixTime), + combinedId: combinedId, + targetId: op.Target, + Message: op.Message, + Files: op.Files, + unixTime: timestamp.Timestamp(op.UnixTime), } switch target := target.(type) { @@ -72,7 +73,7 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { // Updating the corresponding comment for i := range snapshot.Comments { - if snapshot.Comments[i].Id() == commentId { + if snapshot.Comments[i].CombinedId() == combinedId { snapshot.Comments[i].Message = op.Message snapshot.Comments[i].Files = op.Files break |