cleanup, remove approval handler

pull/99/head
Karolis Rusenas 2017-09-24 13:05:39 +01:00
parent 752877fa53
commit a104b8bbd9
2 changed files with 15 additions and 6 deletions

View File

@ -44,7 +44,7 @@ func (b *Bot) requestApproval(req *types.Approval) error {
[]slack.AttachmentField{
slack.AttachmentField{
Title: "Approval required!",
Value: req.Message + "\n" + fmt.Sprintf("To vote for change type '%s lgtm <identifier>' to reject it: '%s reject <identifier>.", b.name, b.name),
Value: req.Message + "\n" + fmt.Sprintf("To vote for change type '%s approve %s' to reject it: '%s reject %s'.", b.name, req.Identifier, b.name, req.Identifier),
Short: false,
},
slack.AttachmentField{
@ -62,6 +62,11 @@ func (b *Bot) requestApproval(req *types.Approval) error {
Value: req.Identifier,
Short: true,
},
slack.AttachmentField{
Title: "Provider",
Value: req.Provider.String(),
Short: true,
},
})
}
@ -105,8 +110,6 @@ func (b *Bot) processApprovedResponse(approvalResponse *approvalResponse) error
if identifier == "" {
continue
}
fmt.Println("approving: ", identifier)
fmt.Println("user: ", approvalResponse.User)
approval, err := b.approvalsManager.Approve(identifier, approvalResponse.User)
if err != nil {
log.WithFields(log.Fields{
@ -116,8 +119,6 @@ func (b *Bot) processApprovedResponse(approvalResponse *approvalResponse) error
continue
}
fmt.Println("approved: ", identifier)
err = b.replyToApproval(approval)
if err != nil {
log.WithFields(log.Fields{
@ -275,3 +276,11 @@ func (b *Bot) approvalsResponse() string {
return buf.String()
}
func (b *Bot) removeApprovalHandler(identifier string) string {
err := b.approvalsManager.Delete(identifier)
if err != nil {
return fmt.Sprintf("failed to remove '%s' approval: %s.", identifier, err)
}
return fmt.Sprintf("approval '%s' removed.", identifier)
}

View File

@ -64,7 +64,7 @@ func main() {
"version": ver.Version,
"go_version": ver.GoVersion,
"arch": ver.Arch,
}).Info("keel starting..")
}).Info("keel starting...")
if os.Getenv(EnvDebug) != "" {
log.SetLevel(log.DebugLevel)