Add metric warning support (announcement bar and DM) (#14483)
* Admin. Advisory: Add warning for number of active users metric status Co-authored-by: Catalin Tomai <catalin.tomai@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
56fb31f06f
Коммит
549e5b57cd
@@ -29,6 +29,7 @@ type mailData struct {
|
||||
mimeTo string
|
||||
smtpTo string
|
||||
from mail.Address
|
||||
cc string
|
||||
replyTo mail.Address
|
||||
subject string
|
||||
htmlBody string
|
||||
@@ -250,7 +251,7 @@ func TestConnection(config *model.Config) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, embeddedFiles map[string]io.Reader, config *model.Config, enableComplianceFeatures bool) *model.AppError {
|
||||
func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, embeddedFiles map[string]io.Reader, config *model.Config, enableComplianceFeatures bool, ccMail string) *model.AppError {
|
||||
fromMail := mail.Address{Name: *config.EmailSettings.FeedbackName, Address: *config.EmailSettings.FeedbackEmail}
|
||||
replyTo := mail.Address{Name: *config.EmailSettings.FeedbackName, Address: *config.EmailSettings.ReplyToAddress}
|
||||
|
||||
@@ -258,6 +259,7 @@ func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, embedded
|
||||
mimeTo: to,
|
||||
smtpTo: to,
|
||||
from: fromMail,
|
||||
cc: ccMail,
|
||||
replyTo: replyTo,
|
||||
subject: subject,
|
||||
htmlBody: htmlBody,
|
||||
@@ -267,8 +269,8 @@ func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, embedded
|
||||
return sendMailUsingConfigAdvanced(mail, config, enableComplianceFeatures)
|
||||
}
|
||||
|
||||
func SendMailUsingConfig(to, subject, htmlBody string, config *model.Config, enableComplianceFeatures bool) *model.AppError {
|
||||
return SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, nil, config, enableComplianceFeatures)
|
||||
func SendMailUsingConfig(to, subject, htmlBody string, config *model.Config, enableComplianceFeatures bool, ccMail string) *model.AppError {
|
||||
return SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, nil, config, enableComplianceFeatures, ccMail)
|
||||
}
|
||||
|
||||
// allows for sending an email with attachments and differing MIME/SMTP recipients
|
||||
@@ -328,6 +330,10 @@ func SendMail(c smtpClient, mail mailData, fileBackend filesstore.FileBackend, d
|
||||
headers["Reply-To"] = []string{mail.replyTo.String()}
|
||||
}
|
||||
|
||||
if len(mail.cc) > 0 {
|
||||
headers["CC"] = []string{mail.cc}
|
||||
}
|
||||
|
||||
for k, v := range mail.mimeHeaders {
|
||||
headers[k] = []string{encodeRFC2047Word(v)}
|
||||
}
|
||||
|
||||
@@ -138,11 +138,12 @@ func TestSendMailUsingConfig(t *testing.T) {
|
||||
var emailTo = "test@example.com"
|
||||
var emailSubject = "Testing this email"
|
||||
var emailBody = "This is a test from autobot"
|
||||
var emailCC = "test@example.com"
|
||||
|
||||
//Delete all the messages before check the sample email
|
||||
DeleteMailBox(emailTo)
|
||||
|
||||
err2 := SendMailUsingConfig(emailTo, emailSubject, emailBody, cfg, true)
|
||||
err2 := SendMailUsingConfig(emailTo, emailSubject, emailBody, cfg, true, emailCC)
|
||||
require.Nil(t, err2, "Should connect to the SMTP Server")
|
||||
|
||||
//Check if the email was send to the right email address
|
||||
@@ -176,6 +177,7 @@ func TestSendMailWithEmbeddedFilesUsingConfig(t *testing.T) {
|
||||
var emailTo = "test@example.com"
|
||||
var emailSubject = "Testing this email"
|
||||
var emailBody = "This is a test from autobot"
|
||||
var emailCC = "test@example.com"
|
||||
|
||||
//Delete all the messages before check the sample email
|
||||
DeleteMailBox(emailTo)
|
||||
@@ -184,7 +186,7 @@ func TestSendMailWithEmbeddedFilesUsingConfig(t *testing.T) {
|
||||
"test1.png": bytes.NewReader([]byte("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),
|
||||
"test2.png": bytes.NewReader([]byte("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),
|
||||
}
|
||||
err2 := SendMailWithEmbeddedFilesUsingConfig(emailTo, emailSubject, emailBody, embeddedFiles, cfg, true)
|
||||
err2 := SendMailWithEmbeddedFilesUsingConfig(emailTo, emailSubject, emailBody, embeddedFiles, cfg, true, emailCC)
|
||||
require.Nil(t, err2, "Should connect to the SMTP Server")
|
||||
|
||||
//Check if the email was send to the right email address
|
||||
@@ -416,7 +418,7 @@ func TestSendMail(t *testing.T) {
|
||||
|
||||
for testName, tc := range testCases {
|
||||
t.Run(testName, func(t *testing.T) {
|
||||
mail := mailData{"", "", mail.Address{}, tc.replyTo, "", "", nil, nil, nil}
|
||||
mail := mailData{"", "", mail.Address{}, "", tc.replyTo, "", "", nil, nil, nil}
|
||||
appErr = SendMail(mocm, mail, mockBackend, time.Now())
|
||||
require.Nil(t, appErr)
|
||||
if len(tc.contains) > 0 {
|
||||
|
||||
Ссылка в новой задаче
Block a user