MM-65575: Fix server panic when bot posts trigger persistent notifications (#34174) (#34778)

* reproduce panic with test

* allow bots in the profile map

* explicitly prevent sending notifications to bots

* persistent notifications: handle senders not in the channel
Этот коммит содержится в:
Jesse Hallam
2025-12-17 11:06:57 -04:00
коммит произвёл GitHub
родитель e150243a7f
Коммит c9d60357db
5 изменённых файлов: 178 добавлений и 6 удалений

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

@@ -600,6 +600,19 @@ func (a *App) getMobileAppSessions(userID string) ([]*model.Session, *model.AppE
}
func (a *App) ShouldSendPushNotification(user *model.User, channelNotifyProps model.StringMap, wasMentioned bool, status *model.Status, post *model.Post, isGM bool) bool {
if user.IsBot {
a.CountNotificationReason(model.NotificationStatusNotSent, model.NotificationTypePush, model.NotificationReasonRecipientIsBot, model.NotificationNoPlatform)
a.NotificationsLog().Debug("Notification not sent - recipient is bot",
mlog.String("type", model.NotificationTypePush),
mlog.String("post_id", post.Id),
mlog.String("status", model.NotificationStatusNotSent),
mlog.String("reason", model.NotificationReasonRecipientIsBot),
mlog.String("sender_id", post.UserId),
mlog.String("receiver_id", user.Id),
)
return false
}
if prop := post.GetProp(model.PostPropsForceNotification); prop != nil && prop != "" {
return true
}