From 2d33f7e90ead2ba7d3e2a85c9c7ee37344fc2f51 Mon Sep 17 00:00:00 2001 From: Lucas Zampieri Date: Tue, 28 Sep 2021 10:22:24 -0300 Subject: [PATCH] Added with-comment fix Moved --with-comment threatment externally, due to conflicts with -m and -f Signed-off-by: Lucas Zampieri --- cmd/mr_approve.go | 5 +++++ cmd/mr_unapprove.go | 5 +++++ cmd/note_common.go | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/mr_approve.go b/cmd/mr_approve.go index d5c643a0..17b8b6e5 100644 --- a/cmd/mr_approve.go +++ b/cmd/mr_approve.go @@ -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") diff --git a/cmd/mr_unapprove.go b/cmd/mr_unapprove.go index 65f66fba..ae100537 100644 --- a/cmd/mr_unapprove.go +++ b/cmd/mr_unapprove.go @@ -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") diff --git a/cmd/note_common.go b/cmd/note_common.go index 53fd0f6a..9b649626 100644 --- a/cmd/note_common.go +++ b/cmd/note_common.go @@ -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 {