diff options
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 |