summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/model/compliance_post.go
diff options
context:
space:
mode:
authorDuco van Amstel <helcaraxan@gmail.com>2018-11-18 17:55:05 +0000
committerWim <wim@42.be>2018-11-25 21:21:04 +0100
commit09875fe1603307080f3a4172985c5dca3bd9912d (patch)
treea23220772f6f6597d509ca71b2df3480a77b8076 /vendor/github.com/mattermost/mattermost-server/model/compliance_post.go
parentf716b8fc0ff90f47b61e218ef34019b38bd70e0d (diff)
downloadmatterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.gz
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.bz2
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.zip
Update direct dependencies where possible
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/model/compliance_post.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/model/compliance_post.go117
1 files changed, 117 insertions, 0 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/model/compliance_post.go b/vendor/github.com/mattermost/mattermost-server/model/compliance_post.go
new file mode 100644
index 00000000..75e8de1f
--- /dev/null
+++ b/vendor/github.com/mattermost/mattermost-server/model/compliance_post.go
@@ -0,0 +1,117 @@
+// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "regexp"
+ "time"
+)
+
+type CompliancePost struct {
+
+ // From Team
+ TeamName string
+ TeamDisplayName string
+
+ // From Channel
+ ChannelName string
+ ChannelDisplayName string
+ ChannelType string
+
+ // From User
+ UserUsername string
+ UserEmail string
+ UserNickname string
+
+ // From Post
+ PostId string
+ PostCreateAt int64
+ PostUpdateAt int64
+ PostDeleteAt int64
+ PostRootId string
+ PostParentId string
+ PostOriginalId string
+ PostMessage string
+ PostType string
+ PostProps string
+ PostHashtags string
+ PostFileIds string
+}
+
+func CompliancePostHeader() []string {
+ return []string{
+ "TeamName",
+ "TeamDisplayName",
+
+ "ChannelName",
+ "ChannelDisplayName",
+ "ChannelType",
+
+ "UserUsername",
+ "UserEmail",
+ "UserNickname",
+
+ "PostId",
+ "PostCreateAt",
+ "PostUpdateAt",
+ "PostDeleteAt",
+ "PostRootId",
+ "PostParentId",
+ "PostOriginalId",
+ "PostMessage",
+ "PostType",
+ "PostProps",
+ "PostHashtags",
+ "PostFileIds",
+ }
+}
+
+func cleanComplianceStrings(in string) string {
+ if matched, _ := regexp.MatchString("^\\s*(=|\\+|\\-)", in); matched {
+ return "'" + in
+
+ } else {
+ return in
+ }
+}
+
+func (me *CompliancePost) Row() []string {
+
+ postDeleteAt := ""
+ if me.PostDeleteAt > 0 {
+ postDeleteAt = time.Unix(0, me.PostDeleteAt*int64(1000*1000)).Format(time.RFC3339)
+ }
+
+ postUpdateAt := ""
+ if me.PostUpdateAt != me.PostCreateAt {
+ postUpdateAt = time.Unix(0, me.PostUpdateAt*int64(1000*1000)).Format(time.RFC3339)
+ }
+
+ return []string{
+ cleanComplianceStrings(me.TeamName),
+ cleanComplianceStrings(me.TeamDisplayName),
+
+ cleanComplianceStrings(me.ChannelName),
+ cleanComplianceStrings(me.ChannelDisplayName),
+ cleanComplianceStrings(me.ChannelType),
+
+ cleanComplianceStrings(me.UserUsername),
+ cleanComplianceStrings(me.UserEmail),
+ cleanComplianceStrings(me.UserNickname),
+
+ me.PostId,
+ time.Unix(0, me.PostCreateAt*int64(1000*1000)).Format(time.RFC3339),
+ postUpdateAt,
+ postDeleteAt,
+
+ me.PostRootId,
+ me.PostParentId,
+ me.PostOriginalId,
+ cleanComplianceStrings(me.PostMessage),
+ me.PostType,
+ me.PostProps,
+ me.PostHashtags,
+ me.PostFileIds,
+ }
+}