|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
Copyright 2017-2022 CAcert Inc.
|
|
|
|
|
Copyright 2017-2024 CAcert Inc.
|
|
|
|
|
SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
@ -38,6 +38,7 @@ type MailConfig struct {
|
|
|
|
|
SMTPHost string `yaml:"smtp_host"`
|
|
|
|
|
SMTPPort int `yaml:"smtp_port"`
|
|
|
|
|
SMTPTimeOut time.Duration `yaml:"smtp_timeout,omitempty"`
|
|
|
|
|
Domain string `yaml:"message_id_domain"`
|
|
|
|
|
NotificationSenderAddress string `yaml:"notification_sender_address"`
|
|
|
|
|
NoticeMailAddress string `yaml:"notice_mail_address"`
|
|
|
|
|
VoteNoticeMailAddress string `yaml:"vote_notice_mail_address"`
|
|
|
|
@ -202,10 +203,10 @@ func voteNoticeRecipient(mc *MailConfig) recipientData {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func motionReplyHeaders(m *models.Motion) map[string][]string {
|
|
|
|
|
func motionReplyHeaders(m *models.Motion, mc *MailConfig) map[string][]string {
|
|
|
|
|
return map[string][]string{
|
|
|
|
|
"References": {fmt.Sprintf("<%s>", m.Tag)},
|
|
|
|
|
"In-Reply-To": {fmt.Sprintf("<%s>", m.Tag)},
|
|
|
|
|
"References": {fmt.Sprintf("<%s@%s>", m.Tag, mc.Domain)},
|
|
|
|
|
"In-Reply-To": {fmt.Sprintf("<%s@%s>", m.Tag, mc.Domain)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -247,7 +248,7 @@ func (c *ClosedDecisionNotification) GetNotificationContent(mc *MailConfig) *Not
|
|
|
|
|
*models.Motion
|
|
|
|
|
}{Motion: c.Decision},
|
|
|
|
|
subject: fmt.Sprintf("Re: %s - %s - finalized", c.Decision.Tag, c.Decision.Title),
|
|
|
|
|
headers: motionReplyHeaders(c.Decision),
|
|
|
|
|
headers: motionReplyHeaders(c.Decision, mc),
|
|
|
|
|
recipients: []recipientData{defaultRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -275,14 +276,14 @@ func (n NewDecisionNotification) GetNotificationContent(mc *MailConfig) *Notific
|
|
|
|
|
UnvotedURL: unvotedURL,
|
|
|
|
|
},
|
|
|
|
|
subject: fmt.Sprintf("%s - %s", n.Decision.Tag, n.Decision.Title),
|
|
|
|
|
headers: n.getHeaders(),
|
|
|
|
|
headers: n.getHeaders(mc),
|
|
|
|
|
recipients: []recipientData{defaultRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (n NewDecisionNotification) getHeaders() map[string][]string {
|
|
|
|
|
func (n NewDecisionNotification) getHeaders(mc *MailConfig) map[string][]string {
|
|
|
|
|
return map[string][]string{
|
|
|
|
|
"Message-ID": {fmt.Sprintf("<%s>", n.Decision.Tag)},
|
|
|
|
|
"Message-ID": {fmt.Sprintf("<%s@%s>", n.Decision.Tag, mc.Domain)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -309,7 +310,7 @@ func (u UpdateDecisionNotification) GetNotificationContent(mc *MailConfig) *Noti
|
|
|
|
|
UnvotedURL: unvotedURL,
|
|
|
|
|
},
|
|
|
|
|
subject: fmt.Sprintf("%s - %s", u.Decision.Tag, u.Decision.Title),
|
|
|
|
|
headers: motionReplyHeaders(u.Decision),
|
|
|
|
|
headers: motionReplyHeaders(u.Decision, mc),
|
|
|
|
|
recipients: []recipientData{defaultRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -333,7 +334,7 @@ func (d DirectVoteNotification) GetNotificationContent(mc *MailConfig) *Notifica
|
|
|
|
|
Choice: d.Choice,
|
|
|
|
|
},
|
|
|
|
|
subject: fmt.Sprintf("Re: %s - %s", d.Decision.Tag, d.Decision.Title),
|
|
|
|
|
headers: motionReplyHeaders(d.Decision),
|
|
|
|
|
headers: motionReplyHeaders(d.Decision, mc),
|
|
|
|
|
recipients: []recipientData{voteNoticeRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -363,7 +364,7 @@ func (p ProxyVoteNotification) GetNotificationContent(mc *MailConfig) *Notificat
|
|
|
|
|
Justification: p.Justification,
|
|
|
|
|
},
|
|
|
|
|
subject: fmt.Sprintf("Re: %s - %s", p.Decision.Tag, p.Decision.Title),
|
|
|
|
|
headers: motionReplyHeaders(p.Decision),
|
|
|
|
|
headers: motionReplyHeaders(p.Decision, mc),
|
|
|
|
|
recipients: []recipientData{voteNoticeRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -381,7 +382,7 @@ func (w WithDrawMotionNotification) GetNotificationContent(mc *MailConfig) *Noti
|
|
|
|
|
Name string
|
|
|
|
|
}{Motion: w.Motion, Name: w.Voter.Name},
|
|
|
|
|
subject: fmt.Sprintf("Re: %s - %s", w.Motion.Tag, w.Motion.Title),
|
|
|
|
|
headers: motionReplyHeaders(w.Motion),
|
|
|
|
|
headers: motionReplyHeaders(w.Motion, mc),
|
|
|
|
|
recipients: []recipientData{defaultRecipient(mc)},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|