diff options
author | Josh Bialkowski <josh.bialkowski@gmail.com> | 2019-11-22 22:34:19 -0800 |
---|---|---|
committer | Josh Bialkowski <josh.bialkowski@gmail.com> | 2019-12-18 07:42:16 -0800 |
commit | cd889572f7870a62758240b323a9086a76c5120a (patch) | |
tree | 2d8a210632e3b82517cd259760e94e375ebff123 /bug/op_edit_comment.go | |
parent | 7657a38ff20a7b3b2dbec5e6c981038c871f46e7 (diff) | |
download | git-bug-cd889572f7870a62758240b323a9086a76c5120a.tar.gz |
codereview #2: some cleanup, correct use of nothing-events
* return error, don't panic
* skipping status export is an error
* use switch in config.go
* move PromptPassword to input
* move client construction into getIdentityClient
* use non-pointer context throughout client since it is an interface
* remove some TODOs
* don't emit multiple nothing-events, just one per bug only if nothing
happened.
* rename EditBody to EditCreateComment
* add configuration notes about additional values
* store bug id map in a dictionary in the config
* some fixes from testing
Diffstat (limited to 'bug/op_edit_comment.go')
-rw-r--r-- | bug/op_edit_comment.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index 905dd960..fecba67a 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -148,12 +148,6 @@ func EditComment(b Interface, author identity.Interface, unixTime int64, target return EditCommentWithFiles(b, author, unixTime, target, message, nil) } -// Convenience function to edit the body of a bug (the first comment) -func EditBody(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error) { - createOp := b.FirstOp().(*CreateOperation) - return EditComment(b, author, unixTime, createOp.Id(), message) -} - func EditCommentWithFiles(b Interface, author identity.Interface, unixTime int64, target entity.Id, message string, files []git.Hash) (*EditCommentOperation, error) { editCommentOp := NewEditCommentOp(author, unixTime, target, message, files) if err := editCommentOp.Validate(); err != nil { @@ -163,3 +157,14 @@ func EditCommentWithFiles(b Interface, author identity.Interface, unixTime int64 return editCommentOp, nil } +// Convenience function to edit the body of a bug (the first comment) +func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error) { + createOp := b.FirstOp().(*CreateOperation) + return EditComment(b, author, unixTime, createOp.Id(), message) +} + +// Convenience function to edit the body of a bug (the first comment) +func EditCreateCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []git.Hash) (*EditCommentOperation, error) { + createOp := b.FirstOp().(*CreateOperation) + return EditCommentWithFiles(b, author, unixTime, createOp.Id(), message, files) +} |