From aa82597e2d35e7f04a3102b481dd978442a740d2 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Mon, 23 Oct 2023 20:22:36 +0200 Subject: [PATCH] [MM-55048] Pretty print posts, users, channels and teams in logs (#25029) --- server/public/model/channel.go | 4 ++++ server/public/model/post.go | 4 ++++ server/public/model/team.go | 4 ++++ server/public/model/user.go | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/server/public/model/channel.go b/server/public/model/channel.go index eaf3c79018..1f44a3e50f 100644 --- a/server/public/model/channel.go +++ b/server/public/model/channel.go @@ -82,6 +82,10 @@ func (o *Channel) Auditable() map[string]interface{} { } } +func (o *Channel) LogClone() any { + return o.Auditable() +} + type ChannelWithTeamData struct { Channel TeamDisplayName string `json:"team_display_name"` diff --git a/server/public/model/post.go b/server/public/model/post.go index fe0d4d6fb1..e67728fe29 100644 --- a/server/public/model/post.go +++ b/server/public/model/post.go @@ -146,6 +146,10 @@ func (o *Post) Auditable() map[string]interface{} { } } +func (o *Post) LogClone() any { + return o.Auditable() +} + type PostEphemeral struct { UserID string `json:"user_id"` Post *Post `json:"post"` diff --git a/server/public/model/team.go b/server/public/model/team.go index f6b8ca71c4..6e48ac8cb8 100644 --- a/server/public/model/team.go +++ b/server/public/model/team.go @@ -60,6 +60,10 @@ func (o *Team) Auditable() map[string]interface{} { } } +func (o *Team) LogClone() any { + return o.Auditable() +} + type TeamPatch struct { DisplayName *string `json:"display_name"` Description *string `json:"description"` diff --git a/server/public/model/user.go b/server/public/model/user.go index baf28be7bc..fa1169c70d 100644 --- a/server/public/model/user.go +++ b/server/public/model/user.go @@ -139,6 +139,10 @@ func (u *User) Auditable() map[string]interface{} { } } +func (u *User) LogClone() any { + return u.Auditable() +} + //msgp UserMap // UserMap is a map from a userId to a user object.