diff options
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go b/vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go index a86087c1..0211805e 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/compliance.go @@ -37,6 +37,19 @@ type Compliance struct { type Compliances []Compliance +// ComplianceExportCursor is used for paginated iteration of posts +// for compliance export. +// We need to keep track of the last post ID in addition to the last post +// CreateAt to break ties when two posts have the same CreateAt. +type ComplianceExportCursor struct { + LastChannelsQueryPostCreateAt int64 + LastChannelsQueryPostID string + ChannelsQueryCompleted bool + LastDirectMessagesQueryPostCreateAt int64 + LastDirectMessagesQueryPostID string + DirectMessagesQueryCompleted bool +} + func (c *Compliance) ToJson() string { b, _ := json.Marshal(c) return string(b) @@ -58,6 +71,11 @@ func (c *Compliance) PreSave() { c.CreateAt = GetMillis() } +func (c *Compliance) DeepCopy() *Compliance { + copy := *c + return © +} + func (c *Compliance) JobName() string { jobName := c.Type if c.Type == COMPLIANCE_TYPE_DAILY { @@ -79,7 +97,7 @@ func (c *Compliance) IsValid() *AppError { return NewAppError("Compliance.IsValid", "model.compliance.is_valid.create_at.app_error", nil, "", http.StatusBadRequest) } - if len(c.Desc) > 512 || len(c.Desc) == 0 { + if len(c.Desc) > 512 || c.Desc == "" { return NewAppError("Compliance.IsValid", "model.compliance.is_valid.desc.app_error", nil, "", http.StatusBadRequest) } @@ -105,11 +123,11 @@ func ComplianceFromJson(data io.Reader) *Compliance { } func (c Compliances) ToJson() string { - if b, err := json.Marshal(c); err != nil { + b, err := json.Marshal(c) + if err != nil { return "[]" - } else { - return string(b) } + return string(b) } func CompliancesFromJson(data io.Reader) Compliances { |