Manual Cherrypick: Add audits for accessing posts without membership (#31266) (#35022)

Automatic Merge
Этот коммит содержится в:
Daniel Espino García
2026-01-26 11:23:28 +01:00
коммит произвёл GitHub
родитель 12dce033d6
Коммит 21a86506f9
79 изменённых файлов: 1707 добавлений и 1001 удалений

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

@@ -2895,7 +2895,7 @@ func (a *App) UpdateThreadFollowForUserFromChannelAdd(c request.CTX, userID, tea
}
a.sanitizeProfiles(userThread.Participants, false)
userThread.Post.SanitizeProps()
sanitizedPost, appErr := a.SanitizePostMetadataForUser(c, userThread.Post, userID)
sanitizedPost, isMemberForPreviews, appErr := a.SanitizePostMetadataForUser(c, userThread.Post, userID)
if appErr != nil {
return appErr
}
@@ -2909,6 +2909,16 @@ func (a *App) UpdateThreadFollowForUserFromChannelAdd(c request.CTX, userID, tea
message.Add("previous_unread_replies", int64(0))
message.Add("previous_unread_mentions", int64(0))
auditRec := a.MakeAuditRecord(c, "websocketPost", model.AuditStatusSuccess)
defer a.LogAuditRec(c, auditRec, nil)
model.AddEventParameterToAuditRec(auditRec, "post_id", userThread.Post.Id)
model.AddEventParameterToAuditRec(auditRec, "user_id", userID)
model.AddEventParameterToAuditRec(auditRec, "source", "UpdateThreadFollowForUserFromChannelAdd")
if !isMemberForPreviews {
model.AddEventParameterToAuditRec(auditRec, "non_channel_member_access", true)
}
auditRec.Success()
a.Publish(message)
return nil
}