MM-7881 non-case sensitive username notifications off by default (#13851)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0340eb466f
Коммит
c4701394d3
@@ -391,7 +391,7 @@ func (u *User) SetDefaultNotifications() {
|
||||
u.NotifyProps[PUSH_NOTIFY_PROP] = USER_NOTIFY_MENTION
|
||||
u.NotifyProps[DESKTOP_NOTIFY_PROP] = USER_NOTIFY_MENTION
|
||||
u.NotifyProps[DESKTOP_SOUND_NOTIFY_PROP] = "true"
|
||||
u.NotifyProps[MENTION_KEYS_NOTIFY_PROP] = u.Username + ",@" + u.Username
|
||||
u.NotifyProps[MENTION_KEYS_NOTIFY_PROP] = ""
|
||||
u.NotifyProps[CHANNEL_MENTIONS_NOTIFY_PROP] = "true"
|
||||
u.NotifyProps[PUSH_STATUS_NOTIFY_PROP] = STATUS_AWAY
|
||||
u.NotifyProps[COMMENTS_NOTIFY_PROP] = COMMENTS_NOTIFY_NEVER
|
||||
@@ -406,7 +406,7 @@ func (u *User) UpdateMentionKeysFromUsername(oldUsername string) {
|
||||
}
|
||||
}
|
||||
|
||||
u.NotifyProps[MENTION_KEYS_NOTIFY_PROP] = u.Username + ",@" + u.Username
|
||||
u.NotifyProps[MENTION_KEYS_NOTIFY_PROP] = ""
|
||||
if len(nonUsernameKeys) > 0 {
|
||||
u.NotifyProps[MENTION_KEYS_NOTIFY_PROP] += "," + strings.Join(nonUsernameKeys, ",")
|
||||
}
|
||||
|
||||
@@ -75,19 +75,19 @@ func TestUserPreUpdate(t *testing.T) {
|
||||
func TestUserUpdateMentionKeysFromUsername(t *testing.T) {
|
||||
user := User{Username: "user"}
|
||||
user.SetDefaultNotifications()
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "user,@user", "default mention keys are invalid: %v", user.NotifyProps["mention_keys"])
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "", "default mention keys are invalid: %v", user.NotifyProps["mention_keys"])
|
||||
|
||||
user.Username = "person"
|
||||
user.UpdateMentionKeysFromUsername("user")
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "person,@person", "mention keys are invalid after changing username: %v", user.NotifyProps["mention_keys"])
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "", "mention keys are invalid after changing username: %v", user.NotifyProps["mention_keys"])
|
||||
|
||||
user.NotifyProps["mention_keys"] += ",mention"
|
||||
user.UpdateMentionKeysFromUsername("person")
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "person,@person,mention", "mention keys are invalid after adding extra mention keyword: %v", user.NotifyProps["mention_keys"])
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], ",mention", "mention keys are invalid after adding extra mention keyword: %v", user.NotifyProps["mention_keys"])
|
||||
|
||||
user.Username = "user"
|
||||
user.UpdateMentionKeysFromUsername("person")
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], "user,@user,mention", "mention keys are invalid after changing username with extra mention keyword: %v", user.NotifyProps["mention_keys"])
|
||||
assert.Equalf(t, user.NotifyProps["mention_keys"], ",mention", "mention keys are invalid after changing username with extra mention keyword: %v", user.NotifyProps["mention_keys"])
|
||||
}
|
||||
|
||||
func TestUserIsValid(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user