in docbot/action.go [297:327]
func (a *Action) addAndCleanupHelpComment(login, body string) error {
commentIDs, err := a.getLabelInvalidCommentIDs(body)
if err != nil {
logger.Errorf("Failed to get the comment list: %v", err)
return err
}
if len(commentIDs) == 0 {
err = a.createComment(fmt.Sprintf("@%s %s", login, body))
if err != nil {
logger.Errorf("Failed to create %s comment: %v", body, err)
return err
}
return nil
} else {
// cleanup
if len(commentIDs) > 1 {
for index, id := range commentIDs {
if index == 0 {
continue
}
err := a.deleteComment(id)
if err != nil {
logger.Errorf("Failed to delete %v comment: %v", id, err)
return err
}
}
}
}
return nil
}