summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
authorJonathan <jonfritz@gmail.com>2017-12-01 09:25:14 -0500
committerGitHub <noreply@github.com>2017-12-01 09:25:14 -0500
commit9791c3e8d2e2ade6c593437ec7f59feb932998a9 (patch)
tree9a8fe8672925d5a288c23803e7c401b0adf2c270 /model/config.go
parentb51d9e8eabb3cfea17b81ebadcdc8199e09544bb (diff)
downloadchat-9791c3e8d2e2ade6c593437ec7f59feb932998a9.tar.gz
chat-9791c3e8d2e2ade6c593437ec7f59feb932998a9.tar.bz2
chat-9791c3e8d2e2ade6c593437ec7f59feb932998a9.zip
Changed config behaviour such that exportFromTimestamp is set/unset when message export is enabled/disabled (#7925)
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/model/config.go b/model/config.go
index 1f56eb4f5..232d40b22 100644
--- a/model/config.go
+++ b/model/config.go
@@ -1534,6 +1534,14 @@ func (s *MessageExportSettings) SetDefaults() {
s.ExportFromTimestamp = NewInt64(0)
}
+ if s.EnableExport != nil && *s.EnableExport && *s.ExportFromTimestamp == int64(0) {
+ // when the feature is enabled via the System Console, use the current timestamp as the start time for future exports
+ s.ExportFromTimestamp = NewInt64(GetMillis())
+ } else if s.EnableExport != nil && !*s.EnableExport {
+ // when the feature is disabled, reset the timestamp so that the timestamp will be set if the feature is re-enabled
+ s.ExportFromTimestamp = NewInt64(0)
+ }
+
if s.BatchSize == nil {
s.BatchSize = NewInt(10000)
}
@@ -2040,7 +2048,7 @@ func (mes *MessageExportSettings) isValid(fs FileSettings) *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.enable.app_error", nil, "", http.StatusBadRequest)
}
if *mes.EnableExport {
- if mes.ExportFromTimestamp == nil || *mes.ExportFromTimestamp < 0 || *mes.ExportFromTimestamp > time.Now().Unix() {
+ if mes.ExportFromTimestamp == nil || *mes.ExportFromTimestamp < 0 || *mes.ExportFromTimestamp > GetMillis() {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.export_from.app_error", nil, "", http.StatusBadRequest)
} else if mes.DailyRunTime == nil {
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.daily_runtime.app_error", nil, "", http.StatusBadRequest)