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

Этот коммит содержится в:
M-ZubairAhmed
2024-11-08 12:21:27 +00:00
коммит произвёл GitHub
родитель 0031e77b09
Коммит 30a6ddc995
2 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@@ -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) {