From 3f6ef50883492f77995a7e27872d0b5ae17b9d6a Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 14 Feb 2021 11:36:32 +0100 Subject: bug: migrate to the DAG entity structure! --- bug/op_edit_comment.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'bug/op_edit_comment.go') diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index 5bfc36bf..f9e30e62 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -27,19 +27,15 @@ type EditCommentOperation struct { // Sign-post method for gqlgen func (op *EditCommentOperation) IsOperation() {} -func (op *EditCommentOperation) base() *OpBase { - return &op.OpBase -} - func (op *EditCommentOperation) Id() entity.Id { - return idOperation(op) + return idOperation(op, &op.OpBase) } func (op *EditCommentOperation) Apply(snapshot *Snapshot) { // Todo: currently any message can be edited, even by a different author // crypto signature are needed. - snapshot.addActor(op.Author) + snapshot.addActor(op.Author_) var target TimelineItem @@ -85,7 +81,7 @@ func (op *EditCommentOperation) GetFiles() []repository.Hash { } func (op *EditCommentOperation) Validate() error { - if err := opBaseValidate(op, EditCommentOp); err != nil { + if err := op.OpBase.Validate(op, EditCommentOp); err != nil { return err } -- cgit From d0d7be8db010e2c68c98d0a34387e4fac0c4d6ee Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 14 Feb 2021 12:14:03 +0100 Subject: minor cleanups --- bug/op_edit_comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bug/op_edit_comment.go') diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index f9e30e62..e08aeaad 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -96,7 +96,7 @@ func (op *EditCommentOperation) Validate() error { return nil } -// UnmarshalJSON is a two step JSON unmarshaling +// UnmarshalJSON is a two step JSON unmarshalling // This workaround is necessary to avoid the inner OpBase.MarshalJSON // overriding the outer op's MarshalJSON func (op *EditCommentOperation) UnmarshalJSON(data []byte) error { -- cgit From bd09541752ef4db008500d238762ebe7f2f7be39 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 20 Feb 2021 14:37:06 +0100 Subject: entity: no sign-post needed --- bug/op_edit_comment.go | 3 --- 1 file changed, 3 deletions(-) (limited to 'bug/op_edit_comment.go') diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index e08aeaad..653ab71e 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -24,9 +24,6 @@ type EditCommentOperation struct { Files []repository.Hash `json:"files"` } -// Sign-post method for gqlgen -func (op *EditCommentOperation) IsOperation() {} - func (op *EditCommentOperation) Id() entity.Id { return idOperation(op, &op.OpBase) } -- cgit From 214abe4dea1984086e45d1399538fb12aa010642 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 20 Feb 2021 15:48:44 +0100 Subject: WIP operation with files --- bug/op_edit_comment.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bug/op_edit_comment.go') diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index 653ab71e..3e6634e4 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/MichaelMure/git-bug/entity" + "github.com/MichaelMure/git-bug/entity/dag" "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/timestamp" @@ -15,6 +16,7 @@ import ( ) var _ Operation = &EditCommentOperation{} +var _ dag.OperationWithFiles = &EditCommentOperation{} // EditCommentOperation will change a comment in the bug type EditCommentOperation struct { -- cgit