diff --git a/model/channel_member_history_result.go b/model/channel_member_history_result.go index ed3e796393..11cb19d37e 100644 --- a/model/channel_member_history_result.go +++ b/model/channel_member_history_result.go @@ -12,4 +12,5 @@ type ChannelMemberHistoryResult struct { // these two fields are never set in the database - when we SELECT, we join on Users to get them UserEmail string `db:"Email"` Username string + IsBot bool } diff --git a/model/message_export.go b/model/message_export.go index 1cf764a6e5..56608cdfef 100644 --- a/model/message_export.go +++ b/model/message_export.go @@ -16,6 +16,7 @@ type MessageExport struct { UserId *string UserEmail *string Username *string + IsBot bool PostId *string PostCreateAt *int64 diff --git a/store/sqlstore/channel_member_history_store.go b/store/sqlstore/channel_member_history_store.go index 70ad16467f..9487b954f0 100644 --- a/store/sqlstore/channel_member_history_store.go +++ b/store/sqlstore/channel_member_history_store.go @@ -112,9 +112,11 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMemberHistoryTable(startTime SELECT cmh.*, u.Email, - u.Username + u.Username, + Bots.UserId IS NOT NULL AS IsBot FROM ChannelMemberHistory cmh INNER JOIN Users u ON cmh.UserId = u.Id + LEFT JOIN Bots ON Bots.UserId = u.Id WHERE cmh.ChannelId = :ChannelId AND cmh.JoinTime <= :EndTime AND (cmh.LeaveTime IS NULL OR cmh.LeaveTime >= :StartTime) @@ -135,9 +137,12 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMembersTable(startTime int64 ch.ChannelId, ch.UserId, u.Email, - u.Username + u.Username, + Bots.UserId IS NOT NULL AS IsBot + FROM ChannelMembers AS ch INNER JOIN Users AS u ON ch.UserId = u.id + LEFT JOIN Bots ON Bots.UserId = u.Id WHERE ch.ChannelId = :ChannelId` params := map[string]interface{}{"ChannelId": channelId} diff --git a/templates/globalrelay_compliance_export.html b/templates/globalrelay_compliance_export.html index da93f887ca..538d8517c2 100644 --- a/templates/globalrelay_compliance_export.html +++ b/templates/globalrelay_compliance_export.html @@ -71,6 +71,7 @@ + diff --git a/templates/globalrelay_compliance_export_message.html b/templates/globalrelay_compliance_export_message.html index 3a47b29b70..ff3bcd9fdf 100644 --- a/templates/globalrelay_compliance_export_message.html +++ b/templates/globalrelay_compliance_export_message.html @@ -2,6 +2,7 @@
  • {{.Props.SentTime}} @{{.Props.Username}} + {{.Props.UserType}} ({{.Props.Email}}): {{.Props.Message}}
  • diff --git a/templates/globalrelay_compliance_export_participant_row.html b/templates/globalrelay_compliance_export_participant_row.html index 554c47c162..db14c56bc0 100644 --- a/templates/globalrelay_compliance_export_participant_row.html +++ b/templates/globalrelay_compliance_export_participant_row.html @@ -1,6 +1,7 @@ {{define "globalrelay_compliance_export_participant_row"}} +
    Username
    UserType
    Joined Left
    @{{.Props.Username}}{{.Props.UserType}} {{.Props.Joined}} {{.Props.Left}}