[MM-37118] Don't mark channel as read for reply posts with CRT on (#17965)

Summary
With CRT on, posting a reply to a thread should NOT mark the channel containing the the thread as read

Ticket Link
https://mattermost.atlassian.net/browse/MM-37118
Этот коммит содержится в:
Ashish Bhate
2021-07-29 14:47:28 +05:30
коммит произвёл GitHub
родитель c61c649c02
Коммит 0f07a934ff
2 изменённых файлов: 77 добавлений и 3 удалений

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

@@ -86,11 +86,14 @@ func (a *App) CreatePostAsUser(c *request.Context, post *model.Post, currentSess
return nil, err
}
// Update the LastViewAt only if the post does not have from_webhook prop set (e.g. Zapier app),
// or if it does not have from_bot set (e.g. from discovering the user is a bot within CreatePost).
// Update the Channel LastViewAt only if:
// the post does NOT have from_webhook prop set (e.g. Zapier app), and
// the post does NOT have from_bot set (e.g. from discovering the user is a bot within CreatePost), and
// the post is NOT a reply post with CRT enabled
_, fromWebhook := post.GetProps()["from_webhook"]
_, fromBot := post.GetProps()["from_bot"]
if !fromWebhook && !fromBot {
isCRTReply := post.RootId != "" && a.isCRTEnabledForUser(post.UserId)
if !fromWebhook && !fromBot && !isCRTReply {
if _, err := a.MarkChannelsAsViewed([]string{post.ChannelId}, post.UserId, currentSessionId, true); err != nil {
mlog.Warn(
"Encountered error updating last viewed",