mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add debug log for nil referencedPost (#18437)
* add debug log for nil post * add post id for context * log other vars that may be nil * change from Warn to Debug
This commit is contained in:
@@ -5,6 +5,7 @@ package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
@@ -490,16 +491,34 @@ func (a *App) getLinkMetadata(requestURL string, timestamp int64, isNewPost bool
|
||||
return nil, nil, nil, appErr
|
||||
}
|
||||
|
||||
if referencedPost == nil {
|
||||
msg := "Referenced post is nil"
|
||||
mlog.Debug(msg, mlog.String("post_id", referencedPostID))
|
||||
return nil, nil, nil, errors.New(msg)
|
||||
}
|
||||
|
||||
referencedChannel, appErr := a.GetChannel(referencedPost.ChannelId)
|
||||
if appErr != nil {
|
||||
return nil, nil, nil, appErr
|
||||
}
|
||||
|
||||
if referencedChannel == nil {
|
||||
msg := "Referenced channel is nil"
|
||||
mlog.Debug(msg, mlog.String("channel_id", referencedPost.ChannelId))
|
||||
return nil, nil, nil, errors.New(msg)
|
||||
}
|
||||
|
||||
referencedTeam, appErr := a.GetTeam(referencedChannel.TeamId)
|
||||
if appErr != nil {
|
||||
return nil, nil, nil, appErr
|
||||
}
|
||||
|
||||
if referencedTeam == nil {
|
||||
msg := "Referenced team is nil"
|
||||
mlog.Debug(msg, mlog.String("team_id", referencedChannel.TeamId))
|
||||
return nil, nil, nil, errors.New(msg)
|
||||
}
|
||||
|
||||
permalink = &model.Permalink{PreviewPost: model.NewPreviewPost(referencedPost, referencedTeam, referencedChannel)}
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user