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

Этот коммит содержится в:
Eli Yukelzon
2019-05-23 13:33:18 +03:00
коммит произвёл GitHub
родитель a8caee330a
Коммит e59674cfdd
6 изменённых файлов: 12 добавлений и 2 удалений

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

@@ -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 // these two fields are never set in the database - when we SELECT, we join on Users to get them
UserEmail string `db:"Email"` UserEmail string `db:"Email"`
Username string Username string
IsBot bool
} }

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

@@ -16,6 +16,7 @@ type MessageExport struct {
UserId *string UserId *string
UserEmail *string UserEmail *string
Username *string Username *string
IsBot bool
PostId *string PostId *string
PostCreateAt *int64 PostCreateAt *int64

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

@@ -112,9 +112,11 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMemberHistoryTable(startTime
SELECT SELECT
cmh.*, cmh.*,
u.Email, u.Email,
u.Username u.Username,
Bots.UserId IS NOT NULL AS IsBot
FROM ChannelMemberHistory cmh FROM ChannelMemberHistory cmh
INNER JOIN Users u ON cmh.UserId = u.Id INNER JOIN Users u ON cmh.UserId = u.Id
LEFT JOIN Bots ON Bots.UserId = u.Id
WHERE cmh.ChannelId = :ChannelId WHERE cmh.ChannelId = :ChannelId
AND cmh.JoinTime <= :EndTime AND cmh.JoinTime <= :EndTime
AND (cmh.LeaveTime IS NULL OR cmh.LeaveTime >= :StartTime) AND (cmh.LeaveTime IS NULL OR cmh.LeaveTime >= :StartTime)
@@ -135,9 +137,12 @@ func (s SqlChannelMemberHistoryStore) getFromChannelMembersTable(startTime int64
ch.ChannelId, ch.ChannelId,
ch.UserId, ch.UserId,
u.Email, u.Email,
u.Username u.Username,
Bots.UserId IS NOT NULL AS IsBot
FROM ChannelMembers AS ch FROM ChannelMembers AS ch
INNER JOIN Users AS u ON ch.UserId = u.id INNER JOIN Users AS u ON ch.UserId = u.id
LEFT JOIN Bots ON Bots.UserId = u.Id
WHERE ch.ChannelId = :ChannelId` WHERE ch.ChannelId = :ChannelId`
params := map[string]interface{}{"ChannelId": channelId} params := map[string]interface{}{"ChannelId": channelId}

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

@@ -71,6 +71,7 @@
<table class="participants"> <table class="participants">
<tr> <tr>
<th class="username">Username<br></th> <th class="username">Username<br></th>
<th class="usertype">UserType<br></th>
<th class="email">Email</th> <th class="email">Email</th>
<th class="joined">Joined</th> <th class="joined">Joined</th>
<th class="left">Left</th> <th class="left">Left</th>

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

@@ -2,6 +2,7 @@
<li class="message"> <li class="message">
<span class="sent_time">{{.Props.SentTime}}</span> <span class="sent_time">{{.Props.SentTime}}</span>
<span class="username">@{{.Props.Username}}</span> <span class="username">@{{.Props.Username}}</span>
<span class="usertype">{{.Props.UserType}}</span>
<span class="email">({{.Props.Email}}):</span> <span class="email">({{.Props.Email}}):</span>
<span class="message">{{.Props.Message}}</span> <span class="message">{{.Props.Message}}</span>
</li> </li>

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

@@ -1,6 +1,7 @@
{{define "globalrelay_compliance_export_participant_row"}} {{define "globalrelay_compliance_export_participant_row"}}
<tr> <tr>
<td class="username">@{{.Props.Username}}</td> <td class="username">@{{.Props.Username}}</td>
<td class="usertype">{{.Props.UserType}}</td>
<td class="email">{{.Props.Email}}</td> <td class="email">{{.Props.Email}}</td>
<td class="joined">{{.Props.Joined}}</td> <td class="joined">{{.Props.Joined}}</td>
<td class="left">{{.Props.Left}}</td> <td class="left">{{.Props.Left}}</td>