refactor. changed CRTNotifier logic to not send notification when thread reply notifications setting is disabled (#26062)
Signed-off-by: titanventura <aswath7862001@gmail.com>
Этот коммит содержится в:
@@ -1319,7 +1319,7 @@ type CRTNotifiers struct {
|
||||
func (c *CRTNotifiers) addFollowerToNotify(user *model.User, mentions *MentionResults, channelMemberNotificationProps model.StringMap, channel *model.Channel) {
|
||||
_, userWasMentioned := mentions.Mentions[user.Id]
|
||||
notifyDesktop, notifyPush, notifyEmail := shouldUserNotifyCRT(user, userWasMentioned)
|
||||
notifyChannelDesktop, notifyChannelPush := shouldChannelMemberNotifyCRT(channelMemberNotificationProps, userWasMentioned)
|
||||
notifyChannelDesktop, notifyChannelPush := shouldChannelMemberNotifyCRT(user.NotifyProps, channelMemberNotificationProps, userWasMentioned)
|
||||
|
||||
// respect the user global notify props when there are no channel specific ones (default)
|
||||
// otherwise respect the channel member's notify props
|
||||
@@ -1374,19 +1374,20 @@ func shouldUserNotifyCRT(user *model.User, isMentioned bool) (notifyDesktop, not
|
||||
}
|
||||
|
||||
// channel specific settings check for desktop and push notifications
|
||||
func shouldChannelMemberNotifyCRT(notifyProps model.StringMap, isMentioned bool) (notifyDesktop, notifyPush bool) {
|
||||
func shouldChannelMemberNotifyCRT(userNotifyProps model.StringMap, channelMemberNotifyProps model.StringMap, isMentioned bool) (notifyDesktop, notifyPush bool) {
|
||||
notifyDesktop = false
|
||||
notifyPush = false
|
||||
|
||||
desktop := notifyProps[model.DesktopNotifyProp]
|
||||
push := notifyProps[model.PushNotifyProp]
|
||||
desktop := channelMemberNotifyProps[model.DesktopNotifyProp]
|
||||
push := channelMemberNotifyProps[model.PushNotifyProp]
|
||||
|
||||
desktopThreads := notifyProps[model.DesktopThreadsNotifyProp]
|
||||
pushThreads := notifyProps[model.PushThreadsNotifyProp]
|
||||
desktopThreads := channelMemberNotifyProps[model.DesktopThreadsNotifyProp]
|
||||
userDesktopThreads := userNotifyProps[model.DesktopThreadsNotifyProp]
|
||||
pushThreads := channelMemberNotifyProps[model.PushThreadsNotifyProp]
|
||||
|
||||
// user should be notified via desktop notification in the case the notify prop is not set as no notify or default
|
||||
// and either the user was mentioned or the CRT notify prop for desktop is set to all
|
||||
if desktop != model.ChannelNotifyDefault && desktop != model.ChannelNotifyNone && (isMentioned || desktopThreads == model.ChannelNotifyAll || desktop == model.ChannelNotifyAll) {
|
||||
if desktop != model.ChannelNotifyDefault && desktop != model.ChannelNotifyNone && (isMentioned || (desktopThreads == model.ChannelNotifyAll && userDesktopThreads != model.UserNotifyMention) || desktop == model.ChannelNotifyAll) {
|
||||
notifyDesktop = true
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user