From 450c0b3ccb091a3f84f35aca0319ba358ffd5633 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 30 Jan 2017 15:43:34 -0500 Subject: Improvments to typing messages (#5230) --- model/config.go | 94 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 39 deletions(-) (limited to 'model') diff --git a/model/config.go b/model/config.go index 13e795170..4588731b6 100644 --- a/model/config.go +++ b/model/config.go @@ -64,45 +64,47 @@ const ( ) type ServiceSettings struct { - SiteURL *string - ListenAddress string - ConnectionSecurity *string - TLSCertFile *string - TLSKeyFile *string - UseLetsEncrypt *bool - LetsEncryptCertificateCacheFile *string - Forward80To443 *bool - ReadTimeout *int - WriteTimeout *int - MaximumLoginAttempts int - SegmentDeveloperKey string - GoogleDeveloperKey string - EnableOAuthServiceProvider bool - EnableIncomingWebhooks bool - EnableOutgoingWebhooks bool - EnableCommands *bool - EnableOnlyAdminIntegrations *bool - EnablePostUsernameOverride bool - EnablePostIconOverride bool - EnableTesting bool - EnableDeveloper *bool - EnableSecurityFixAlert *bool - EnableInsecureOutgoingConnections *bool - EnableMultifactorAuthentication *bool - EnforceMultifactorAuthentication *bool - AllowCorsFrom *string - SessionLengthWebInDays *int - SessionLengthMobileInDays *int - SessionLengthSSOInDays *int - SessionCacheInMinutes *int - WebsocketSecurePort *int - WebsocketPort *int - WebserverMode *string - EnableCustomEmoji *bool - RestrictCustomEmojiCreation *string - RestrictPostDelete *string - AllowEditPost *string - PostEditTimeLimit *int + SiteURL *string + ListenAddress string + ConnectionSecurity *string + TLSCertFile *string + TLSKeyFile *string + UseLetsEncrypt *bool + LetsEncryptCertificateCacheFile *string + Forward80To443 *bool + ReadTimeout *int + WriteTimeout *int + MaximumLoginAttempts int + SegmentDeveloperKey string + GoogleDeveloperKey string + EnableOAuthServiceProvider bool + EnableIncomingWebhooks bool + EnableOutgoingWebhooks bool + EnableCommands *bool + EnableOnlyAdminIntegrations *bool + EnablePostUsernameOverride bool + EnablePostIconOverride bool + EnableTesting bool + EnableDeveloper *bool + EnableSecurityFixAlert *bool + EnableInsecureOutgoingConnections *bool + EnableMultifactorAuthentication *bool + EnforceMultifactorAuthentication *bool + AllowCorsFrom *string + SessionLengthWebInDays *int + SessionLengthMobileInDays *int + SessionLengthSSOInDays *int + SessionCacheInMinutes *int + WebsocketSecurePort *int + WebsocketPort *int + WebserverMode *string + EnableCustomEmoji *bool + RestrictCustomEmojiCreation *string + RestrictPostDelete *string + AllowEditPost *string + PostEditTimeLimit *int + TimeBetweenUserTypingUpdatesMilliseconds *int64 + EnableUserTypingMessages *bool } type ClusterSettings struct { @@ -1072,6 +1074,16 @@ func (o *Config) SetDefaults() { *o.MetricsSettings.BlockProfileRate = 0 } + if o.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds == nil { + o.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds = new(int64) + *o.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds = 5000 + } + + if o.ServiceSettings.EnableUserTypingMessages == nil { + o.ServiceSettings.EnableUserTypingMessages = new(bool) + *o.ServiceSettings.EnableUserTypingMessages = true + } + o.defaultWebrtcSettings() } @@ -1303,6 +1315,10 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.write_timeout.app_error", nil, "") } + if *o.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds < 1000 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.time_between_user_typing.app_error", nil, "") + } + return nil } -- cgit v1.2.3-1-g7c22