mirror of
https://github.com/harness-community/drone-email.git
synced 2026-06-04 18:24:18 +08:00
Fix an issue where a mail would be sent to the same recipient twice
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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 == "" {
|
||||
|
||||
Reference in New Issue
Block a user