summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2018-05-25 22:52:17 +0800
committerChristopher Speller <crspeller@gmail.com>2018-05-25 07:52:17 -0700
commit58abb4204e2e5d7c82312ed18a3d4d1a3a5f1962 (patch)
tree9ee08a603c5ffa403f1c6b31c31ae0b69500e83d
parent94b2eca2d1b6d9c75cc2ed702ccfa38b58a9cf86 (diff)
downloadchat-58abb4204e2e5d7c82312ed18a3d4d1a3a5f1962.tar.gz
chat-58abb4204e2e5d7c82312ed18a3d4d1a3a5f1962.tar.bz2
chat-58abb4204e2e5d7c82312ed18a3d4d1a3a5f1962.zip
[MM-10645] Remove desktop duration notify props (#8851)
* remove desktop duration notify props Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com> * fix test Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com>
-rw-r--r--app/import.go16
-rw-r--r--app/import_test.go10
-rw-r--r--i18n/en.json4
-rw-r--r--model/user.go1
4 files changed, 2 insertions, 29 deletions
diff --git a/app/import.go b/app/import.go
index fc0bfafa6..8075497a0 100644
--- a/app/import.go
+++ b/app/import.go
@@ -79,9 +79,8 @@ type UserImportData struct {
}
type UserNotifyPropsImportData struct {
- Desktop *string `json:"desktop"`
- DesktopDuration *string `json:"desktop_duration"`
- DesktopSound *string `json:"desktop_sound"`
+ Desktop *string `json:"desktop"`
+ DesktopSound *string `json:"desktop_sound"`
Email *string `json:"email"`
@@ -608,13 +607,6 @@ func (a *App) ImportUser(data *UserImportData, dryRun bool) *model.AppError {
}
}
- if data.NotifyProps.DesktopDuration != nil {
- if value, ok := user.NotifyProps[model.DESKTOP_DURATION_NOTIFY_PROP]; !ok || value != *data.NotifyProps.DesktopDuration {
- user.AddNotifyProp(model.DESKTOP_DURATION_NOTIFY_PROP, *data.NotifyProps.DesktopDuration)
- hasNotifyPropsChanged = true
- }
- }
-
if data.NotifyProps.DesktopSound != nil {
if value, ok := user.NotifyProps[model.DESKTOP_SOUND_NOTIFY_PROP]; !ok || value != *data.NotifyProps.DesktopSound {
user.AddNotifyProp(model.DESKTOP_SOUND_NOTIFY_PROP, *data.NotifyProps.DesktopSound)
@@ -969,10 +961,6 @@ func validateUserImportData(data *UserImportData) *model.AppError {
return model.NewAppError("BulkImport", "app.import.validate_user_import_data.notify_props_desktop_invalid.error", nil, "", http.StatusBadRequest)
}
- if data.NotifyProps.DesktopDuration != nil && !model.IsValidNumberString(*data.NotifyProps.DesktopDuration) {
- return model.NewAppError("BulkImport", "app.import.validate_user_import_data.notify_props_desktop_duration_invalid.error", nil, "", http.StatusBadRequest)
- }
-
if data.NotifyProps.DesktopSound != nil && !model.IsValidTrueOrFalseString(*data.NotifyProps.DesktopSound) {
return model.NewAppError("BulkImport", "app.import.validate_user_import_data.notify_props_desktop_sound_invalid.error", nil, "", http.StatusBadRequest)
}
diff --git a/app/import_test.go b/app/import_test.go
index 1024a5438..a6bc7c467 100644
--- a/app/import_test.go
+++ b/app/import_test.go
@@ -430,10 +430,6 @@ func TestImportValidateUserImportData(t *testing.T) {
checkError(t, validateUserImportData(&data))
data.NotifyProps.Desktop = ptrStr(model.USER_NOTIFY_ALL)
- data.NotifyProps.DesktopDuration = ptrStr("invalid")
- checkError(t, validateUserImportData(&data))
-
- data.NotifyProps.DesktopDuration = ptrStr("5")
data.NotifyProps.DesktopSound = ptrStr("invalid")
checkError(t, validateUserImportData(&data))
@@ -1980,7 +1976,6 @@ func TestImportImportUser(t *testing.T) {
// Set Notify Props
data.NotifyProps = &UserNotifyPropsImportData{
Desktop: ptrStr(model.USER_NOTIFY_ALL),
- DesktopDuration: ptrStr("5"),
DesktopSound: ptrStr("true"),
Email: ptrStr("true"),
Mobile: ptrStr(model.USER_NOTIFY_ALL),
@@ -1999,7 +1994,6 @@ func TestImportImportUser(t *testing.T) {
}
checkNotifyProp(t, user, model.DESKTOP_NOTIFY_PROP, model.USER_NOTIFY_ALL)
- checkNotifyProp(t, user, model.DESKTOP_DURATION_NOTIFY_PROP, "5")
checkNotifyProp(t, user, model.DESKTOP_SOUND_NOTIFY_PROP, "true")
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "true")
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_ALL)
@@ -2011,7 +2005,6 @@ func TestImportImportUser(t *testing.T) {
// Change Notify Props
data.NotifyProps = &UserNotifyPropsImportData{
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
- DesktopDuration: ptrStr("3"),
DesktopSound: ptrStr("false"),
Email: ptrStr("false"),
Mobile: ptrStr(model.USER_NOTIFY_NONE),
@@ -2030,7 +2023,6 @@ func TestImportImportUser(t *testing.T) {
}
checkNotifyProp(t, user, model.DESKTOP_NOTIFY_PROP, model.USER_NOTIFY_MENTION)
- checkNotifyProp(t, user, model.DESKTOP_DURATION_NOTIFY_PROP, "3")
checkNotifyProp(t, user, model.DESKTOP_SOUND_NOTIFY_PROP, "false")
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
@@ -2047,7 +2039,6 @@ func TestImportImportUser(t *testing.T) {
}
data.NotifyProps = &UserNotifyPropsImportData{
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
- DesktopDuration: ptrStr("3"),
DesktopSound: ptrStr("false"),
Email: ptrStr("false"),
Mobile: ptrStr(model.USER_NOTIFY_NONE),
@@ -2067,7 +2058,6 @@ func TestImportImportUser(t *testing.T) {
}
checkNotifyProp(t, user, model.DESKTOP_NOTIFY_PROP, model.USER_NOTIFY_MENTION)
- checkNotifyProp(t, user, model.DESKTOP_DURATION_NOTIFY_PROP, "3")
checkNotifyProp(t, user, model.DESKTOP_SOUND_NOTIFY_PROP, "false")
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
diff --git a/i18n/en.json b/i18n/en.json
index d802eb76b..9b59e59f2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -3719,10 +3719,6 @@
"translation": "Invalid Comment Trigger Notify Prop for user."
},
{
- "id": "app.import.validate_user_import_data.notify_props_desktop_duration_invalid.error",
- "translation": "Invalid Desktop Duration Notify Prop value for user."
- },
- {
"id": "app.import.validate_user_import_data.notify_props_desktop_invalid.error",
"translation": "Invalid Desktop Notify Prop value for user."
},
diff --git a/model/user.go b/model/user.go
index 6fbdb09e8..c5d6c13b6 100644
--- a/model/user.go
+++ b/model/user.go
@@ -22,7 +22,6 @@ const (
USER_NOTIFY_NONE = "none"
DESKTOP_NOTIFY_PROP = "desktop"
DESKTOP_SOUND_NOTIFY_PROP = "desktop_sound"
- DESKTOP_DURATION_NOTIFY_PROP = "desktop_duration"
MARK_UNREAD_NOTIFY_PROP = "mark_unread"
PUSH_NOTIFY_PROP = "push"
PUSH_STATUS_NOTIFY_PROP = "push_status"