[MM-61439] New Users: Change default setting for mobile push notifications to 'online, away, or offline'(#29142)

This commit is contained in:
M-ZubairAhmed
2024-11-08 12:21:27 +00:00
committed by GitHub
parent 0031e77b09
commit 30a6ddc995
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -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
+22
View File
@@ -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) {