PLT-3193 Add channel notification preferences for push and email noti… (#5500)
* PLT-3193 Add channel notification preferences for push and email notifications * unit tests, model validation and localization * Feedback review * Adding back allowFromCache check * Setting push and email to use default settings * Move props as constants * address feedback
Этот коммит содержится в:
@@ -226,18 +226,27 @@ func UpdateChannelMemberNotifyProps(data map[string]string, channelId string, us
|
||||
}
|
||||
|
||||
// update whichever notify properties have been provided, but don't change the others
|
||||
if markUnread, exists := data["mark_unread"]; exists {
|
||||
member.NotifyProps["mark_unread"] = markUnread
|
||||
if markUnread, exists := data[model.MARK_UNREAD_NOTIFY_PROP]; exists {
|
||||
member.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] = markUnread
|
||||
}
|
||||
|
||||
if desktop, exists := data["desktop"]; exists {
|
||||
member.NotifyProps["desktop"] = desktop
|
||||
if desktop, exists := data[model.DESKTOP_NOTIFY_PROP]; exists {
|
||||
member.NotifyProps[model.DESKTOP_NOTIFY_PROP] = desktop
|
||||
}
|
||||
|
||||
if email, exists := data[model.EMAIL_NOTIFY_PROP]; exists {
|
||||
member.NotifyProps[model.EMAIL_NOTIFY_PROP] = email
|
||||
}
|
||||
|
||||
if push, exists := data[model.PUSH_NOTIFY_PROP]; exists {
|
||||
member.NotifyProps[model.PUSH_NOTIFY_PROP] = push
|
||||
}
|
||||
|
||||
if result := <-Srv.Store.Channel().UpdateMember(member); result.Err != nil {
|
||||
return nil, result.Err
|
||||
} else {
|
||||
InvalidateCacheForUser(userId)
|
||||
InvalidateCacheForChannelMembersNotifyProps(channelId)
|
||||
return member, nil
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user