aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
Diffstat (limited to 'bug')
-rw-r--r--bug/bug.go3
-rw-r--r--bug/interface.go6
-rw-r--r--bug/op_add_comment.go3
-rw-r--r--bug/op_create.go3
-rw-r--r--bug/op_edit_comment.go12
-rw-r--r--bug/op_label_change.go3
-rw-r--r--bug/op_noop.go3
-rw-r--r--bug/op_set_metadata.go3
-rw-r--r--bug/op_set_status.go3
-rw-r--r--bug/op_set_title.go3
-rw-r--r--bug/operation.go3
-rw-r--r--bug/status.go2
12 files changed, 34 insertions, 13 deletions
diff --git a/bug/bug.go b/bug/bug.go
index ae662ef1..e3378770 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -677,6 +677,3 @@ func (bug *Bug) Compile() Snapshot {
return snap
}
-
-// Sign post method for gqlgen
-func (bug *Bug) IsAuthored() {}
diff --git a/bug/interface.go b/bug/interface.go
index 796ee569..5c8f2729 100644
--- a/bug/interface.go
+++ b/bug/interface.go
@@ -46,11 +46,11 @@ type Interface interface {
}
func bugFromInterface(bug Interface) *Bug {
- switch bug.(type) {
+ switch bug := bug.(type) {
case *Bug:
- return bug.(*Bug)
+ return bug
case *WithSnapshot:
- return bug.(*WithSnapshot).Bug
+ return bug.Bug
default:
panic("missing type case")
}
diff --git a/bug/op_add_comment.go b/bug/op_add_comment.go
index e16ea0dd..78c8847a 100644
--- a/bug/op_add_comment.go
+++ b/bug/op_add_comment.go
@@ -21,6 +21,9 @@ type AddCommentOperation struct {
Files []git.Hash `json:"files"`
}
+// Sign-post method for gqlgen
+func (op *AddCommentOperation) IsOperation() {}
+
func (op *AddCommentOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_create.go b/bug/op_create.go
index 0da95d4d..b2af438b 100644
--- a/bug/op_create.go
+++ b/bug/op_create.go
@@ -22,6 +22,9 @@ type CreateOperation struct {
Files []git.Hash `json:"files"`
}
+// Sign-post method for gqlgen
+func (op *CreateOperation) IsOperation() {}
+
func (op *CreateOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go
index fecba67a..f82e7590 100644
--- a/bug/op_edit_comment.go
+++ b/bug/op_edit_comment.go
@@ -24,6 +24,9 @@ type EditCommentOperation struct {
Files []git.Hash `json:"files"`
}
+// Sign-post method for gqlgen
+func (op *EditCommentOperation) IsOperation() {}
+
func (op *EditCommentOperation) base() *OpBase {
return &op.OpBase
}
@@ -59,14 +62,11 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) {
UnixTime: timestamp.Timestamp(op.UnixTime),
}
- switch target.(type) {
+ switch target := target.(type) {
case *CreateTimelineItem:
- item := target.(*CreateTimelineItem)
- item.Append(comment)
-
+ target.Append(comment)
case *AddCommentTimelineItem:
- item := target.(*AddCommentTimelineItem)
- item.Append(comment)
+ target.Append(comment)
}
// Updating the corresponding comment
diff --git a/bug/op_label_change.go b/bug/op_label_change.go
index c911de26..fefe2402 100644
--- a/bug/op_label_change.go
+++ b/bug/op_label_change.go
@@ -21,6 +21,9 @@ type LabelChangeOperation struct {
Removed []Label `json:"removed"`
}
+// Sign-post method for gqlgen
+func (op *LabelChangeOperation) IsOperation() {}
+
func (op *LabelChangeOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_noop.go b/bug/op_noop.go
index 16d32297..6364f918 100644
--- a/bug/op_noop.go
+++ b/bug/op_noop.go
@@ -16,6 +16,9 @@ type NoOpOperation struct {
OpBase
}
+// Sign-post method for gqlgen
+func (op *NoOpOperation) IsOperation() {}
+
func (op *NoOpOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_set_metadata.go b/bug/op_set_metadata.go
index 67f7e009..23d11461 100644
--- a/bug/op_set_metadata.go
+++ b/bug/op_set_metadata.go
@@ -17,6 +17,9 @@ type SetMetadataOperation struct {
NewMetadata map[string]string `json:"new_metadata"`
}
+// Sign-post method for gqlgen
+func (op *SetMetadataOperation) IsOperation() {}
+
func (op *SetMetadataOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_set_status.go b/bug/op_set_status.go
index 8a245184..eb2c0ba4 100644
--- a/bug/op_set_status.go
+++ b/bug/op_set_status.go
@@ -18,6 +18,9 @@ type SetStatusOperation struct {
Status Status `json:"status"`
}
+// Sign-post method for gqlgen
+func (op *SetStatusOperation) IsOperation() {}
+
func (op *SetStatusOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/op_set_title.go b/bug/op_set_title.go
index fadd29a9..ddd98f0e 100644
--- a/bug/op_set_title.go
+++ b/bug/op_set_title.go
@@ -21,6 +21,9 @@ type SetTitleOperation struct {
Was string `json:"was"`
}
+// Sign-post method for gqlgen
+func (op *SetTitleOperation) IsOperation() {}
+
func (op *SetTitleOperation) base() *OpBase {
return &op.OpBase
}
diff --git a/bug/operation.go b/bug/operation.go
index dd95e096..20d44f6c 100644
--- a/bug/operation.go
+++ b/bug/operation.go
@@ -52,6 +52,9 @@ type Operation interface {
AllMetadata() map[string]string
// GetAuthor return the author identity
GetAuthor() identity.Interface
+
+ // sign-post method for gqlgen
+ IsOperation()
}
func deriveId(data []byte) entity.Id {
diff --git a/bug/status.go b/bug/status.go
index 737c8d31..9e998034 100644
--- a/bug/status.go
+++ b/bug/status.go
@@ -44,7 +44,7 @@ func StatusFromString(str string) (Status, error) {
case "closed":
return ClosedStatus, nil
default:
- return 0, fmt.Errorf("unknow status")
+ return 0, fmt.Errorf("unknown status")
}
}