summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2017-02-23 11:08:48 -0300
committerGitHub <noreply@github.com>2017-02-23 11:08:48 -0300
commit748a416961923932e9b2969beb2730ee8c240ea7 (patch)
treef6ab74d35fc1be8b9015f8a89e7ac6058ec1d4fe /app/channel.go
parentca7d3b6e7bc2e52cf40180a462492313f298e760 (diff)
downloadchat-748a416961923932e9b2969beb2730ee8c240ea7.tar.gz
chat-748a416961923932e9b2969beb2730ee8c240ea7.tar.bz2
chat-748a416961923932e9b2969beb2730ee8c240ea7.zip
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
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/channel.go b/app/channel.go
index db007dd3b..fb4198c37 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -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
}
}