mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
app/testEmail: remove a setting that blocks testEmail (#15022)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
16ffb6712f
commit
1fadfa9f33
@@ -5,6 +5,7 @@ package api4
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
@@ -98,18 +99,31 @@ func TestEmailTest(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
config := model.Config{
|
||||
ServiceSettings: model.ServiceSettings{
|
||||
SiteURL: model.NewString(""),
|
||||
},
|
||||
EmailSettings: model.EmailSettings{
|
||||
SMTPServer: model.NewString(""),
|
||||
SMTPPort: model.NewString(""),
|
||||
SMTPPassword: model.NewString(""),
|
||||
FeedbackName: model.NewString(""),
|
||||
FeedbackEmail: model.NewString(""),
|
||||
ReplyToAddress: model.NewString(""),
|
||||
SendEmailNotifications: model.NewBool(false),
|
||||
SMTPServer: model.NewString(""),
|
||||
SMTPPort: model.NewString(""),
|
||||
SMTPPassword: model.NewString(""),
|
||||
FeedbackName: model.NewString(""),
|
||||
FeedbackEmail: model.NewString("some-addr@test.com"),
|
||||
ReplyToAddress: model.NewString("some-addr@test.com"),
|
||||
ConnectionSecurity: model.NewString(""),
|
||||
SMTPUsername: model.NewString(""),
|
||||
EnableSMTPAuth: model.NewBool(false),
|
||||
SkipServerCertificateVerification: model.NewBool(true),
|
||||
SendEmailNotifications: model.NewBool(false),
|
||||
SMTPServerTimeout: model.NewInt(15),
|
||||
},
|
||||
FileSettings: model.FileSettings{
|
||||
DriverName: model.NewString(model.IMAGE_DRIVER_LOCAL),
|
||||
Directory: model.NewString(dir),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -128,9 +142,9 @@ func TestEmailTest(t *testing.T) {
|
||||
inbucket_host = "localhost"
|
||||
}
|
||||
|
||||
inbucket_port := os.Getenv("CI_INBUCKET_PORT")
|
||||
inbucket_port := os.Getenv("CI_INBUCKET_SMTP_PORT")
|
||||
if inbucket_port == "" {
|
||||
inbucket_port = "9000"
|
||||
inbucket_port = "10025"
|
||||
}
|
||||
|
||||
*config.EmailSettings.SMTPServer = inbucket_host
|
||||
|
||||
@@ -201,10 +201,6 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError {
|
||||
return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !*cfg.EmailSettings.SendEmailNotifications {
|
||||
return nil
|
||||
}
|
||||
|
||||
// if the user hasn't changed their email settings, fill in the actual SMTP password so that
|
||||
// the user can verify an existing SMTP connection
|
||||
if *cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
||||
|
||||
Reference in New Issue
Block a user