Skip to content

Commit

Permalink
Added with-comment fix
Browse files Browse the repository at this point in the history
Moved --with-comment threatment externally, due to conflicts with -m
and -f

Signed-off-by: Lucas Zampieri <[email protected]>
  • Loading branch information
zampierilucas committed Sep 28, 2021
1 parent 3ea4cc3 commit 2d33f7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/mr_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ var mrApproveCmd = &cobra.Command{
if err != nil {
log.Fatal(err)
}
if comment {
state := noteGetState(rn, true, int(id))
msg, _ := noteMsg(msgs, true, int(id), state, "", "")
msgs = append(msgs, msg)
}
}

msgs = append(msgs, "/approve")
Expand Down
5 changes: 5 additions & 0 deletions cmd/mr_unapprove.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ var mrUnapproveCmd = &cobra.Command{
if err != nil {
log.Fatal(err)
}
if comment {
state := noteGetState(rn, true, int(id))
msg, _ := noteMsg(msgs, true, int(id), state, "", "")
msgs = append(msgs, msg)
}
}

msgs = append(msgs, "/unapprove")
Expand Down
2 changes: 1 addition & 1 deletion cmd/note_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func createNote(rn string, isMR bool, idNum int, msgs []string, filename string,
log.Fatal(err)
}
body = string(content)
if hasNote {
if hasNote && len(msgs) > 0 {
body += msgs[0]
}
} else {
Expand Down

0 comments on commit 2d33f7e

Please sign in to comment.