MM-14721 - Add an identifier for compliance exports when a message is posted by a bot account (#11063)

* check from_bot post property to override IsBot
Этот коммит содержится в:
Eli Yukelzon
2019-06-14 18:36:38 +03:00
коммит произвёл GitHub
родитель e0197ebddf
Коммит 9ec99593eb
3 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@@ -37,6 +37,8 @@ type CompliancePost struct {
PostProps string PostProps string
PostHashtags string PostHashtags string
PostFileIds string PostFileIds string
IsBot bool
} }
func CompliancePostHeader() []string { func CompliancePostHeader() []string {
@@ -64,6 +66,7 @@ func CompliancePostHeader() []string {
"PostProps", "PostProps",
"PostHashtags", "PostHashtags",
"PostFileIds", "PostFileIds",
"UserType",
} }
} }
@@ -88,6 +91,11 @@ func (me *CompliancePost) Row() []string {
postUpdateAt = time.Unix(0, me.PostUpdateAt*int64(1000*1000)).Format(time.RFC3339) postUpdateAt = time.Unix(0, me.PostUpdateAt*int64(1000*1000)).Format(time.RFC3339)
} }
userType := "user"
if me.IsBot {
userType = "bot"
}
return []string{ return []string{
cleanComplianceStrings(me.TeamName), cleanComplianceStrings(me.TeamName),
cleanComplianceStrings(me.TeamDisplayName), cleanComplianceStrings(me.TeamDisplayName),
@@ -99,6 +107,7 @@ func (me *CompliancePost) Row() []string {
cleanComplianceStrings(me.UserUsername), cleanComplianceStrings(me.UserUsername),
cleanComplianceStrings(me.UserEmail), cleanComplianceStrings(me.UserEmail),
cleanComplianceStrings(me.UserNickname), cleanComplianceStrings(me.UserNickname),
userType,
me.PostId, me.PostId,
time.Unix(0, me.PostCreateAt*int64(1000*1000)).Format(time.RFC3339), time.Unix(0, me.PostCreateAt*int64(1000*1000)).Format(time.RFC3339),

Просмотреть файл

@@ -23,6 +23,7 @@ type MessageExport struct {
PostMessage *string PostMessage *string
PostType *string PostType *string
PostRootId *string PostRootId *string
PostProps *string
PostOriginalId *string PostOriginalId *string
PostFileIds StringArray PostFileIds StringArray
} }

Просмотреть файл

@@ -142,12 +142,14 @@ func (s SqlComplianceStore) ComplianceExport(job *model.Compliance) ([]*model.Co
Posts.Type AS PostType, Posts.Type AS PostType,
Posts.Props AS PostProps, Posts.Props AS PostProps,
Posts.Hashtags AS PostHashtags, Posts.Hashtags AS PostHashtags,
Posts.FileIds AS PostFileIds Posts.FileIds AS PostFileIds,
Bots.UserId IS NOT NULL AS IsBot
FROM FROM
Teams, Teams,
Channels, Channels,
Users, Users,
Posts Posts
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
WHERE WHERE
Teams.Id = Channels.TeamId Teams.Id = Channels.TeamId
AND Posts.ChannelId = Channels.Id AND Posts.ChannelId = Channels.Id
@@ -177,11 +179,13 @@ func (s SqlComplianceStore) ComplianceExport(job *model.Compliance) ([]*model.Co
Posts.Type AS PostType, Posts.Type AS PostType,
Posts.Props AS PostProps, Posts.Props AS PostProps,
Posts.Hashtags AS PostHashtags, Posts.Hashtags AS PostHashtags,
Posts.FileIds AS PostFileIds Posts.FileIds AS PostFileIds,
Bots.UserId IS NOT NULL AS IsBot
FROM FROM
Channels, Channels,
Users, Users,
Posts Posts
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
WHERE WHERE
Channels.TeamId = '' Channels.TeamId = ''
AND Posts.ChannelId = Channels.Id AND Posts.ChannelId = Channels.Id
@@ -211,6 +215,7 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
Posts.Type AS PostType, Posts.Type AS PostType,
Posts.OriginalId AS PostOriginalId, Posts.OriginalId AS PostOriginalId,
Posts.RootId AS PostRootId, Posts.RootId AS PostRootId,
Posts.Props AS PostProps,
Posts.FileIds AS PostFileIds, Posts.FileIds AS PostFileIds,
Teams.Id AS TeamId, Teams.Id AS TeamId,
Teams.Name AS TeamName, Teams.Name AS TeamName,
@@ -225,12 +230,14 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
Channels.Type AS ChannelType, Channels.Type AS ChannelType,
Users.Id AS UserId, Users.Id AS UserId,
Users.Email AS UserEmail, Users.Email AS UserEmail,
Users.Username Users.Username,
Bots.UserId IS NOT NULL AS IsBot
FROM FROM
Posts Posts
LEFT OUTER JOIN Channels ON Posts.ChannelId = Channels.Id LEFT OUTER JOIN Channels ON Posts.ChannelId = Channels.Id
LEFT OUTER JOIN Teams ON Channels.TeamId = Teams.Id LEFT OUTER JOIN Teams ON Channels.TeamId = Teams.Id
LEFT OUTER JOIN Users ON Posts.UserId = Users.Id LEFT OUTER JOIN Users ON Posts.UserId = Users.Id
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
WHERE WHERE
Posts.CreateAt > :StartTime AND Posts.CreateAt > :StartTime AND
Posts.Type = '' Posts.Type = ''