Fix bug regarding multiple trello board selection

This commit is contained in:
Glenn Y. Rolland 2018-12-27 13:55:16 +01:00
parent 7d00226118
commit 0ff79c1aab
2 changed files with 17 additions and 3 deletions

View file

@ -11,13 +11,21 @@ func main() {
// Get task list as markdown // Get task list as markdown
trelloCtx := NewTrello(config.TrelloToken) trelloCtx := NewTrello(config.TrelloToken)
for _, trelloBoard := range trelloCtx.GetBoards() {
var trelloBoardsList []TrelloBoard
if len(config.TrelloUrl) > 0 {
trelloBoard := trelloCtx.GetBoard(config.TrelloUrl)
trelloBoardsList = append(trelloBoardsList, trelloBoard)
} else {
trelloBoardsList = trelloCtx.GetBoards()
}
for _, trelloBoard := range trelloBoardsList {
if !trelloBoard.Starred || trelloBoard.Closed { if !trelloBoard.Starred || trelloBoard.Closed {
continue continue
} }
fmt.Printf("Loading board %s\n", trelloBoard.Name) fmt.Printf("Loading board %s\n", trelloBoard.Name)
// trelloBoard := trelloCtx.GetBoard(config.TrelloUrl)
trelloMarkdown := trelloBoard.ExportToMarkdown() trelloMarkdown := trelloBoard.ExportToMarkdown()
trelloHtml := trelloBoard.ExportToHtml() trelloHtml := trelloBoard.ExportToHtml()
config.EmailSubject = fmt.Sprintf("Daily mail for %s", trelloBoard.Name) config.EmailSubject = fmt.Sprintf("Daily mail for %s", trelloBoard.Name)

View file

@ -50,8 +50,8 @@ func NewTransportAuth(config SmtpConfig) *smtp.Auth {
return &auth return &auth
default: default:
return nil
} }
return nil
} }
func NewTransportTls(config SmtpConfig) *tls.Config { func NewTransportTls(config SmtpConfig) *tls.Config {
@ -108,6 +108,12 @@ func (ctx *TransportCtx) Dial() {
} }
func (ctx *TransportCtx) Authenticate() { func (ctx *TransportCtx) Authenticate() {
// guard
if ctx.Auth == nil {
return
}
// ok, we have to
err := ctx.Client.Auth(*ctx.Auth) err := ctx.Client.Auth(*ctx.Auth)
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)