mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
#MM-12130 changes for custom service terms (#9450)
* #MM-12130 changes for custom service terms * Fixed styling * Added getServiceTerms API * removed unnecessary panic * removed custom service terms text from flat config * reverted user sql store as those changes are no longer needed * added tests * Updated a config key to be more standard * Added copyright info * Loading service terms only if the feature is enabled * Loading service terms only if the feature is enabled * removed unused index * added createservice termns API * made a param to bool instead of string * added createservice termns API * review fixes * fixed styling * Minor refactoring * removed saveConfig and loadConfig magic * added empty service terms text check to createServiceTerms API * refactoed some urls to be terms_of_service instead of service_terms * removed check for support settings * changed URLs in tests * removed unused code * fixed a bug * added service termd id in conif * fixed a test * review fixes * minor fixes * Fixed TestCreateServiceTerms
This commit is contained in:
committed by
Jesse Hallam
parent
4e59a27293
commit
af275fe924
@@ -39,6 +39,14 @@ var (
|
||||
"../..",
|
||||
"../../..",
|
||||
}
|
||||
|
||||
serviceTermsEnabledAndEmpty = model.NewAppError(
|
||||
"Config.IsValid",
|
||||
"model.config.is_valid.support.custom_service_terms_text.app_error",
|
||||
nil,
|
||||
"",
|
||||
http.StatusBadRequest,
|
||||
)
|
||||
)
|
||||
|
||||
func FindPath(path string, baseSearchPaths []string, filter func(os.FileInfo) bool) string {
|
||||
@@ -474,7 +482,10 @@ func LoadConfig(fileName string) (*model.Config, string, map[string]interface{},
|
||||
|
||||
config.SetDefaults()
|
||||
|
||||
if err := config.IsValid(); err != nil {
|
||||
// Don't treat it as an error right now if custom service terms are enabled but text is empty.
|
||||
// This is because service terms text will be fetched from database at a later state, but
|
||||
// the flag indicating it is enabled is fetched from config file right away.
|
||||
if err := config.IsValid(); err != nil && err.Id != serviceTermsEnabledAndEmpty.Id {
|
||||
return nil, "", nil, err
|
||||
}
|
||||
|
||||
@@ -690,6 +701,10 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
||||
props["DataRetentionEnableFileDeletion"] = strconv.FormatBool(*c.DataRetentionSettings.EnableFileDeletion)
|
||||
props["DataRetentionFileRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.FileRetentionDays), 10)
|
||||
}
|
||||
|
||||
if *license.Features.CustomTermsOfService {
|
||||
props["EnableCustomServiceTerms"] = strconv.FormatBool(*c.SupportSettings.CustomServiceTermsEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
return props
|
||||
|
||||
Reference in New Issue
Block a user