Fix an issue where a mail would be sent to the same recipient twice
This commit is contained in:
parent
c9430e82e6
commit
ca0f94098b
2
main.go
2
main.go
|
@ -18,7 +18,7 @@ func main() {
|
|||
app.Name = "email plugin"
|
||||
app.Usage = "email plugin"
|
||||
app.Action = run
|
||||
app.Version = "2.0.1"
|
||||
app.Version = "2.0.2"
|
||||
app.Flags = []cli.Flag{
|
||||
// Plugin environment
|
||||
cli.StringFlag{
|
||||
|
|
11
plugin.go
11
plugin.go
|
@ -110,7 +110,16 @@ func (p Plugin) Exec() error {
|
|||
var dialer *gomail.Dialer
|
||||
|
||||
if !p.Config.RecipientsOnly {
|
||||
p.Config.Recipients = append(p.Config.Recipients, p.Commit.Author.Email)
|
||||
exists := false
|
||||
for _, recipient := range p.Config.Recipients {
|
||||
if recipient == p.Commit.Author.Email {
|
||||
exists = true
|
||||
}
|
||||
}
|
||||
|
||||
if !exists {
|
||||
p.Config.Recipients = append(p.Config.Recipients, p.Commit.Author.Email)
|
||||
}
|
||||
}
|
||||
|
||||
if p.Config.Username == "" && p.Config.Password == "" {
|
||||
|
|
Loading…
Reference in a new issue