mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
@@ -37,6 +37,8 @@ type CompliancePost struct {
|
||||
PostProps string
|
||||
PostHashtags string
|
||||
PostFileIds string
|
||||
|
||||
IsBot bool
|
||||
}
|
||||
|
||||
func CompliancePostHeader() []string {
|
||||
@@ -64,6 +66,7 @@ func CompliancePostHeader() []string {
|
||||
"PostProps",
|
||||
"PostHashtags",
|
||||
"PostFileIds",
|
||||
"UserType",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +91,11 @@ func (me *CompliancePost) Row() []string {
|
||||
postUpdateAt = time.Unix(0, me.PostUpdateAt*int64(1000*1000)).Format(time.RFC3339)
|
||||
}
|
||||
|
||||
userType := "user"
|
||||
if me.IsBot {
|
||||
userType = "bot"
|
||||
}
|
||||
|
||||
return []string{
|
||||
cleanComplianceStrings(me.TeamName),
|
||||
cleanComplianceStrings(me.TeamDisplayName),
|
||||
@@ -99,6 +107,7 @@ func (me *CompliancePost) Row() []string {
|
||||
cleanComplianceStrings(me.UserUsername),
|
||||
cleanComplianceStrings(me.UserEmail),
|
||||
cleanComplianceStrings(me.UserNickname),
|
||||
userType,
|
||||
|
||||
me.PostId,
|
||||
time.Unix(0, me.PostCreateAt*int64(1000*1000)).Format(time.RFC3339),
|
||||
|
||||
@@ -23,6 +23,7 @@ type MessageExport struct {
|
||||
PostMessage *string
|
||||
PostType *string
|
||||
PostRootId *string
|
||||
PostProps *string
|
||||
PostOriginalId *string
|
||||
PostFileIds StringArray
|
||||
}
|
||||
|
||||
@@ -142,12 +142,14 @@ func (s SqlComplianceStore) ComplianceExport(job *model.Compliance) ([]*model.Co
|
||||
Posts.Type AS PostType,
|
||||
Posts.Props AS PostProps,
|
||||
Posts.Hashtags AS PostHashtags,
|
||||
Posts.FileIds AS PostFileIds
|
||||
Posts.FileIds AS PostFileIds,
|
||||
Bots.UserId IS NOT NULL AS IsBot
|
||||
FROM
|
||||
Teams,
|
||||
Channels,
|
||||
Users,
|
||||
Posts
|
||||
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
|
||||
WHERE
|
||||
Teams.Id = Channels.TeamId
|
||||
AND Posts.ChannelId = Channels.Id
|
||||
@@ -177,11 +179,13 @@ func (s SqlComplianceStore) ComplianceExport(job *model.Compliance) ([]*model.Co
|
||||
Posts.Type AS PostType,
|
||||
Posts.Props AS PostProps,
|
||||
Posts.Hashtags AS PostHashtags,
|
||||
Posts.FileIds AS PostFileIds
|
||||
Posts.FileIds AS PostFileIds,
|
||||
Bots.UserId IS NOT NULL AS IsBot
|
||||
FROM
|
||||
Channels,
|
||||
Users,
|
||||
Posts
|
||||
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
|
||||
WHERE
|
||||
Channels.TeamId = ''
|
||||
AND Posts.ChannelId = Channels.Id
|
||||
@@ -211,6 +215,7 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
|
||||
Posts.Type AS PostType,
|
||||
Posts.OriginalId AS PostOriginalId,
|
||||
Posts.RootId AS PostRootId,
|
||||
Posts.Props AS PostProps,
|
||||
Posts.FileIds AS PostFileIds,
|
||||
Teams.Id AS TeamId,
|
||||
Teams.Name AS TeamName,
|
||||
@@ -225,12 +230,14 @@ func (s SqlComplianceStore) MessageExport(after int64, limit int) ([]*model.Mess
|
||||
Channels.Type AS ChannelType,
|
||||
Users.Id AS UserId,
|
||||
Users.Email AS UserEmail,
|
||||
Users.Username
|
||||
Users.Username,
|
||||
Bots.UserId IS NOT NULL AS IsBot
|
||||
FROM
|
||||
Posts
|
||||
LEFT OUTER JOIN Channels ON Posts.ChannelId = Channels.Id
|
||||
LEFT OUTER JOIN Teams ON Channels.TeamId = Teams.Id
|
||||
LEFT OUTER JOIN Users ON Posts.UserId = Users.Id
|
||||
LEFT OUTER JOIN Channels ON Posts.ChannelId = Channels.Id
|
||||
LEFT OUTER JOIN Teams ON Channels.TeamId = Teams.Id
|
||||
LEFT OUTER JOIN Users ON Posts.UserId = Users.Id
|
||||
LEFT JOIN Bots ON Bots.UserId = Posts.UserId
|
||||
WHERE
|
||||
Posts.CreateAt > :StartTime AND
|
||||
Posts.Type = ''
|
||||
|
||||
Reference in New Issue
Block a user