MM-10658 Change config fields to pointers (#9033)
* MM 10658 Change config fields to pointers (#8898) * Change fields of config structs to pointers and set defaults MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix tests that go broken during switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Apply changes of current master while switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix new config pointer uses * Fix app tests * Fix mail test * remove debugging statement * fix TestUpdateConfig * assign config consistently * initialize AmazonS3Region in TestS3TestConnection * initialize fields for TestEmailTest * fix TestCheckMandatoryS3Fields
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0c981aa010
Коммит
2ca222033c
16
app/user.go
16
app/user.go
@@ -161,7 +161,7 @@ func (a *App) CreateUserFromSignup(user *model.User) (*model.User, *model.AppErr
|
||||
}
|
||||
|
||||
func (a *App) IsUserSignUpAllowed() *model.AppError {
|
||||
if !a.Config().EmailSettings.EnableSignUpWithEmail || !*a.Config().TeamSettings.EnableUserCreation {
|
||||
if !*a.Config().EmailSettings.EnableSignUpWithEmail || !*a.Config().TeamSettings.EnableUserCreation {
|
||||
err := model.NewAppError("IsUserSignUpAllowed", "api.user.create_user.signup_email_disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
return err
|
||||
}
|
||||
@@ -184,7 +184,7 @@ func (a *App) IsFirstUserAccount() bool {
|
||||
}
|
||||
|
||||
func (a *App) CreateUser(user *model.User) (*model.User, *model.AppError) {
|
||||
if !user.IsLDAPUser() && !user.IsSAMLUser() && !CheckUserDomain(user, a.Config().TeamSettings.RestrictCreationToDomains) {
|
||||
if !user.IsLDAPUser() && !user.IsSAMLUser() && !CheckUserDomain(user, *a.Config().TeamSettings.RestrictCreationToDomains) {
|
||||
return nil, model.NewAppError("CreateUser", "api.user.create_user.accepted_domain.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ func getFont(initialFont string) (*truetype.Font, error) {
|
||||
|
||||
func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) {
|
||||
if len(*a.Config().FileSettings.DriverName) == 0 {
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, a.Config().FileSettings.InitialFont)
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, *a.Config().FileSettings.InitialFont)
|
||||
if appErr != nil {
|
||||
return nil, false, appErr
|
||||
}
|
||||
@@ -709,7 +709,7 @@ func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
|
||||
|
||||
data, err := a.ReadFile(path)
|
||||
if err != nil {
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, a.Config().FileSettings.InitialFont)
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, *a.Config().FileSettings.InitialFont)
|
||||
if appErr != nil {
|
||||
return nil, false, appErr
|
||||
}
|
||||
@@ -726,7 +726,7 @@ func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
|
||||
}
|
||||
|
||||
func (a *App) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError) {
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, a.Config().FileSettings.InitialFont)
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, *a.Config().FileSettings.InitialFont)
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
}
|
||||
@@ -734,7 +734,7 @@ func (a *App) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError)
|
||||
}
|
||||
|
||||
func (a *App) SetDefaultProfileImage(user *model.User) *model.AppError {
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, a.Config().FileSettings.InitialFont)
|
||||
img, appErr := CreateProfileImage(user.Username, user.Id, *a.Config().FileSettings.InitialFont)
|
||||
if appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
@@ -994,7 +994,7 @@ func (a *App) sendUpdatedUserEvent(user model.User) {
|
||||
}
|
||||
|
||||
func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User, *model.AppError) {
|
||||
if !CheckUserDomain(user, a.Config().TeamSettings.RestrictCreationToDomains) {
|
||||
if !CheckUserDomain(user, *a.Config().TeamSettings.RestrictCreationToDomains) {
|
||||
result := <-a.Srv.Store.User().Get(user.Id)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
@@ -1019,7 +1019,7 @@ func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User,
|
||||
}
|
||||
})
|
||||
|
||||
if a.Config().EmailSettings.RequireEmailVerification {
|
||||
if *a.Config().EmailSettings.RequireEmailVerification {
|
||||
a.Srv.Go(func() {
|
||||
if err := a.SendEmailVerification(rusers[0]); err != nil {
|
||||
mlog.Error(err.Error())
|
||||
|
||||
Ссылка в новой задаче
Block a user