diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 13 | ||||
-rw-r--r-- | model/config_test.go | 9 | ||||
-rw-r--r-- | model/license.go | 62 | ||||
-rw-r--r-- | model/license_test.go | 4 |
4 files changed, 61 insertions, 27 deletions
diff --git a/model/config.go b/model/config.go index 5b0916cd3..55fe8490b 100644 --- a/model/config.go +++ b/model/config.go @@ -66,6 +66,9 @@ const ( EMAIL_BATCHING_BUFFER_SIZE = 256 EMAIL_BATCHING_INTERVAL = 30 + EMAIL_NOTIFICATION_CONTENTS_FULL = "full" + EMAIL_NOTIFICATION_CONTENTS_GENERIC = "generic" + SITENAME_MAX_LENGTH = 30 SERVICE_SETTINGS_DEFAULT_SITE_URL = "" @@ -284,6 +287,7 @@ type EmailSettings struct { EmailBatchingBufferSize *int EmailBatchingInterval *int SkipServerCertificateVerification *bool + EmailNotificationContentsType *string } type RateLimitSettings struct { @@ -819,6 +823,11 @@ func (o *Config) SetDefaults() { *o.EmailSettings.SkipServerCertificateVerification = false } + if o.EmailSettings.EmailNotificationContentsType == nil { + o.EmailSettings.EmailNotificationContentsType = new(string) + *o.EmailSettings.EmailNotificationContentsType = EMAIL_NOTIFICATION_CONTENTS_FULL + } + if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) { *o.SupportSettings.TermsOfServiceLink = SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK } @@ -1550,6 +1559,10 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.email_batching_interval.app_error", nil, "") } + if !(*o.EmailSettings.EmailNotificationContentsType == EMAIL_NOTIFICATION_CONTENTS_FULL || *o.EmailSettings.EmailNotificationContentsType == EMAIL_NOTIFICATION_CONTENTS_GENERIC) { + return NewLocAppError("Config.IsValid", "model.config.is_valid.email_notification_contents_type.app_error", nil, "") + } + if o.RateLimitSettings.MemoryStoreSize <= 0 { return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_mem.app_error", nil, "") } diff --git a/model/config_test.go b/model/config_test.go index 62a77c133..1a944710f 100644 --- a/model/config_test.go +++ b/model/config_test.go @@ -15,3 +15,12 @@ func TestConfigDefaultFileSettingsDirectory(t *testing.T) { t.Fatal("FileSettings.Directory should default to './data/'") } } + +func TestConfigDefaultEmailNotificationContentsType(t *testing.T) { + c1 := Config{} + c1.SetDefaults() + + if *c1.EmailSettings.EmailNotificationContentsType != EMAIL_NOTIFICATION_CONTENTS_FULL { + t.Fatal("EmailSettings.EmailNotificationContentsType should default to 'full'") + } +} diff --git a/model/license.go b/model/license.go index 8d53bd4cd..ea1089723 100644 --- a/model/license.go +++ b/model/license.go @@ -37,39 +37,42 @@ type Customer struct { } type Features struct { - Users *int `json:"users"` - LDAP *bool `json:"ldap"` - MFA *bool `json:"mfa"` - GoogleOAuth *bool `json:"google_oauth"` - Office365OAuth *bool `json:"office365_oauth"` - Compliance *bool `json:"compliance"` - Cluster *bool `json:"cluster"` - Metrics *bool `json:"metrics"` - CustomBrand *bool `json:"custom_brand"` - MHPNS *bool `json:"mhpns"` - SAML *bool `json:"saml"` - PasswordRequirements *bool `json:"password_requirements"` - Elasticsearch *bool `json:"elastic_search"` - Announcement *bool `json:"announcement"` + Users *int `json:"users"` + LDAP *bool `json:"ldap"` + MFA *bool `json:"mfa"` + GoogleOAuth *bool `json:"google_oauth"` + Office365OAuth *bool `json:"office365_oauth"` + Compliance *bool `json:"compliance"` + Cluster *bool `json:"cluster"` + Metrics *bool `json:"metrics"` + CustomBrand *bool `json:"custom_brand"` + MHPNS *bool `json:"mhpns"` + SAML *bool `json:"saml"` + PasswordRequirements *bool `json:"password_requirements"` + Elasticsearch *bool `json:"elastic_search"` + Announcement *bool `json:"announcement"` + EmailNotificationContents *bool `json:"email_notification_contents"` + // after we enabled more features for webrtc we'll need to control them with this FutureFeatures *bool `json:"future_features"` } func (f *Features) ToMap() map[string]interface{} { return map[string]interface{}{ - "ldap": *f.LDAP, - "mfa": *f.MFA, - "google": *f.GoogleOAuth, - "office365": *f.Office365OAuth, - "compliance": *f.Compliance, - "cluster": *f.Cluster, - "metrics": *f.Metrics, - "custom_brand": *f.CustomBrand, - "mhpns": *f.MHPNS, - "saml": *f.SAML, - "password": *f.PasswordRequirements, - "elastic_search": *f.Elasticsearch, - "future": *f.FutureFeatures, + "ldap": *f.LDAP, + "mfa": *f.MFA, + "google": *f.GoogleOAuth, + "office365": *f.Office365OAuth, + "compliance": *f.Compliance, + "cluster": *f.Cluster, + "metrics": *f.Metrics, + "custom_brand": *f.CustomBrand, + "mhpns": *f.MHPNS, + "saml": *f.SAML, + "password": *f.PasswordRequirements, + "elastic_search": *f.Elasticsearch, + "email_notification_contents": *f.EmailNotificationContents, + "future": *f.FutureFeatures, } } @@ -148,6 +151,11 @@ func (f *Features) SetDefaults() { f.Announcement = new(bool) *f.Announcement = true } + + if f.EmailNotificationContents == nil { + f.EmailNotificationContents = new(bool) + *f.EmailNotificationContents = *f.FutureFeatures + } } func (l *License) IsExpired() bool { diff --git a/model/license_test.go b/model/license_test.go index 952ab493e..2338c9b93 100644 --- a/model/license_test.go +++ b/model/license_test.go @@ -27,6 +27,7 @@ func TestLicenseFeaturesToMap(t *testing.T) { CheckTrue(t, m["password"].(bool)) CheckTrue(t, m["elastic_search"].(bool)) CheckTrue(t, m["future"].(bool)) + CheckTrue(t, m["email_notification_contents"].(bool)) } func TestLicenseFeaturesSetDefaults(t *testing.T) { @@ -46,6 +47,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) { CheckTrue(t, *f.SAML) CheckTrue(t, *f.PasswordRequirements) CheckTrue(t, *f.Elasticsearch) + CheckTrue(t, *f.EmailNotificationContents) CheckTrue(t, *f.FutureFeatures) f = Features{} @@ -65,6 +67,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) { *f.SAML = true *f.PasswordRequirements = true *f.Elasticsearch = true + *f.EmailNotificationContents = true f.SetDefaults() @@ -81,6 +84,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) { CheckTrue(t, *f.SAML) CheckTrue(t, *f.PasswordRequirements) CheckTrue(t, *f.Elasticsearch) + CheckTrue(t, *f.EmailNotificationContents) CheckFalse(t, *f.FutureFeatures) } |