mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-61439] New Users: Change default setting for mobile push notifications to 'online, away, or offline'(#29142)
This commit is contained in:
parent
0031e77b09
commit
30a6ddc995
@ -567,7 +567,7 @@ func (u *User) SetDefaultNotifications() {
|
||||
u.NotifyProps[DesktopSoundNotifyProp] = "true"
|
||||
u.NotifyProps[MentionKeysNotifyProp] = ""
|
||||
u.NotifyProps[ChannelMentionsNotifyProp] = "true"
|
||||
u.NotifyProps[PushStatusNotifyProp] = StatusAway
|
||||
u.NotifyProps[PushStatusNotifyProp] = StatusOnline
|
||||
u.NotifyProps[CommentsNotifyProp] = CommentsNotifyNever
|
||||
u.NotifyProps[FirstNameNotifyProp] = "false"
|
||||
u.NotifyProps[DesktopThreadsNotifyProp] = UserNotifyAll
|
||||
|
@ -204,6 +204,17 @@ func TestUserPreSave(t *testing.T) {
|
||||
user.Etag(true, true)
|
||||
assert.NotNil(t, user.Timezone, "Timezone is nil")
|
||||
assert.Equal(t, user.Timezone["useAutomaticTimezone"], "true", "Timezone is not set to default")
|
||||
|
||||
// Set default user with notify props
|
||||
userWithDefaultNotifyProps := User{}
|
||||
userWithDefaultNotifyProps.SetDefaultNotifications()
|
||||
|
||||
for notifyPropKey, expectedNotifyPropValue := range userWithDefaultNotifyProps.NotifyProps {
|
||||
actualNotifyPropValue, ok := user.NotifyProps[notifyPropKey]
|
||||
|
||||
assert.True(t, ok, "Notify prop %s is not set", notifyPropKey)
|
||||
assert.Equal(t, expectedNotifyPropValue, actualNotifyPropValue, "Notify prop %s is not set to default", notifyPropKey)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserPreSavePwdTooLong(t *testing.T) {
|
||||
@ -215,6 +226,17 @@ func TestUserPreSavePwdTooLong(t *testing.T) {
|
||||
func TestUserPreUpdate(t *testing.T) {
|
||||
user := User{Password: "test"}
|
||||
user.PreUpdate()
|
||||
|
||||
// Set default user with notify props
|
||||
userWithDefaultNotifyProps := User{}
|
||||
userWithDefaultNotifyProps.SetDefaultNotifications()
|
||||
|
||||
for notifyPropKey, expectedNotifyPropValue := range userWithDefaultNotifyProps.NotifyProps {
|
||||
actualNotifyPropValue, ok := user.NotifyProps[notifyPropKey]
|
||||
|
||||
assert.True(t, ok, "Notify prop %s is not set", notifyPropKey)
|
||||
assert.Equal(t, expectedNotifyPropValue, actualNotifyPropValue, "Notify prop %s is not set to default", notifyPropKey)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserUpdateMentionKeysFromUsername(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user