OSF: Used model.NewPointer everywhere (#27838)

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-08-06 09:15:00 +05:30
коммит произвёл GitHub
родитель f290745496
Коммит c3ed07e679
148 изменённых файлов: 2341 добавлений и 2338 удалений

Просмотреть файл

@@ -137,27 +137,27 @@ func TestEmailTest(t *testing.T) {
es := model.EmailSettings{}
es.SetDefaults(false)
es.SMTPServer = model.NewString("")
es.SMTPPort = model.NewString("")
es.SMTPPassword = model.NewString("")
es.FeedbackName = model.NewString("")
es.FeedbackEmail = model.NewString("some-addr@test.com")
es.ReplyToAddress = model.NewString("some-addr@test.com")
es.ConnectionSecurity = model.NewString("")
es.SMTPUsername = model.NewString("")
es.EnableSMTPAuth = model.NewBool(false)
es.SkipServerCertificateVerification = model.NewBool(true)
es.SendEmailNotifications = model.NewBool(false)
es.SMTPServerTimeout = model.NewInt(15)
es.SMTPServer = model.NewPointer("")
es.SMTPPort = model.NewPointer("")
es.SMTPPassword = model.NewPointer("")
es.FeedbackName = model.NewPointer("")
es.FeedbackEmail = model.NewPointer("some-addr@test.com")
es.ReplyToAddress = model.NewPointer("some-addr@test.com")
es.ConnectionSecurity = model.NewPointer("")
es.SMTPUsername = model.NewPointer("")
es.EnableSMTPAuth = model.NewPointer(false)
es.SkipServerCertificateVerification = model.NewPointer(true)
es.SendEmailNotifications = model.NewPointer(false)
es.SMTPServerTimeout = model.NewPointer(15)
config := model.Config{
ServiceSettings: model.ServiceSettings{
SiteURL: model.NewString(""),
SiteURL: model.NewPointer(""),
},
EmailSettings: es,
FileSettings: model.FileSettings{
DriverName: model.NewString(model.ImageDriverLocal),
Directory: model.NewString(dir),
DriverName: model.NewPointer(model.ImageDriverLocal),
Directory: model.NewPointer(dir),
},
}
@@ -573,14 +573,14 @@ func TestS3TestConnection(t *testing.T) {
fs := model.FileSettings{}
fs.SetDefaults(false)
fs.DriverName = model.NewString(model.ImageDriverS3)
fs.AmazonS3AccessKeyId = model.NewString(model.MinioAccessKey)
fs.AmazonS3SecretAccessKey = model.NewString(model.MinioSecretKey)
fs.AmazonS3Bucket = model.NewString("")
fs.AmazonS3Endpoint = model.NewString(s3Endpoint)
fs.AmazonS3Region = model.NewString("")
fs.AmazonS3PathPrefix = model.NewString("")
fs.AmazonS3SSL = model.NewBool(false)
fs.DriverName = model.NewPointer(model.ImageDriverS3)
fs.AmazonS3AccessKeyId = model.NewPointer(model.MinioAccessKey)
fs.AmazonS3SecretAccessKey = model.NewPointer(model.MinioSecretKey)
fs.AmazonS3Bucket = model.NewPointer("")
fs.AmazonS3Endpoint = model.NewPointer(s3Endpoint)
fs.AmazonS3Region = model.NewPointer("")
fs.AmazonS3PathPrefix = model.NewPointer("")
fs.AmazonS3SSL = model.NewPointer(false)
config := model.Config{
FileSettings: fs,
@@ -599,18 +599,18 @@ func TestS3TestConnection(t *testing.T) {
// If this fails, check the test configuration to ensure minio is setup with the
// `mattermost-test` bucket defined by model.MINIO_BUCKET.
*config.FileSettings.AmazonS3Bucket = model.MinioBucket
config.FileSettings.AmazonS3PathPrefix = model.NewString("")
config.FileSettings.AmazonS3PathPrefix = model.NewPointer("")
*config.FileSettings.AmazonS3Region = "us-east-1"
resp, err = th.SystemAdminClient.TestS3Connection(context.Background(), &config)
require.NoError(t, err)
CheckOKStatus(t, resp)
config.FileSettings.AmazonS3Region = model.NewString("")
config.FileSettings.AmazonS3Region = model.NewPointer("")
resp, err = th.SystemAdminClient.TestS3Connection(context.Background(), &config)
require.NoError(t, err)
CheckOKStatus(t, resp)
config.FileSettings.AmazonS3Bucket = model.NewString("Wrong_bucket")
config.FileSettings.AmazonS3Bucket = model.NewPointer("Wrong_bucket")
resp, err = th.SystemAdminClient.TestS3Connection(context.Background(), &config)
CheckInternalErrorStatus(t, resp)
CheckErrorID(t, err, "api.file.test_connection_s3_bucket_does_not_exist.app_error")
@@ -1054,7 +1054,7 @@ func TestCheckHasNilFields(t *testing.T) {
t.Run("check if the struct has any nil fields", func(t *testing.T) {
s := model.FileSettings{
DriverName: model.NewString(model.ImageDriverLocal),
DriverName: model.NewPointer(model.ImageDriverLocal),
}
res := checkHasNilFields(&s)
require.True(t, res)