[MM-16751] golint model (#17896)
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
953eebdef4
Коммит
97ccf0bdf6
@@ -13,48 +13,48 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW = "direct_channel_show"
|
||||
PREFERENCE_CATEGORY_GROUP_CHANNEL_SHOW = "group_channel_show"
|
||||
PREFERENCE_CATEGORY_TUTORIAL_STEPS = "tutorial_step"
|
||||
PREFERENCE_CATEGORY_ADVANCED_SETTINGS = "advanced_settings"
|
||||
PREFERENCE_CATEGORY_FLAGGED_POST = "flagged_post"
|
||||
PREFERENCE_CATEGORY_FAVORITE_CHANNEL = "favorite_channel"
|
||||
PREFERENCE_CATEGORY_SIDEBAR_SETTINGS = "sidebar_settings"
|
||||
PreferenceCategoryDirectChannelShow = "direct_channel_show"
|
||||
PreferenceCategoryGroupChannelShow = "group_channel_show"
|
||||
PreferenceCategoryTutorialSteps = "tutorial_step"
|
||||
PreferenceCategoryAdvancedSettings = "advanced_settings"
|
||||
PreferenceCategoryFlaggedPost = "flagged_post"
|
||||
PreferenceCategoryFavoriteChannel = "favorite_channel"
|
||||
PreferenceCategorySidebarSettings = "sidebar_settings"
|
||||
|
||||
PREFERENCE_CATEGORY_DISPLAY_SETTINGS = "display_settings"
|
||||
PREFERENCE_NAME_COLLAPSED_THREADS_ENABLED = "collapsed_reply_threads"
|
||||
PREFERENCE_NAME_CHANNEL_DISPLAY_MODE = "channel_display_mode"
|
||||
PREFERENCE_NAME_COLLAPSE_SETTING = "collapse_previews"
|
||||
PREFERENCE_NAME_MESSAGE_DISPLAY = "message_display"
|
||||
PREFERENCE_NAME_NAME_FORMAT = "name_format"
|
||||
PREFERENCE_NAME_USE_MILITARY_TIME = "use_military_time"
|
||||
PreferenceCategoryDisplaySettings = "display_settings"
|
||||
PreferenceNameCollapsedThreadsEnabled = "collapsed_reply_threads"
|
||||
PreferenceNameChannelDisplayMode = "channel_display_mode"
|
||||
PreferenceNameCollapseSetting = "collapse_previews"
|
||||
PreferenceNameMessageDisplay = "message_display"
|
||||
PreferenceNameNameFormat = "name_format"
|
||||
PreferenceNameUseMilitaryTime = "use_military_time"
|
||||
|
||||
PREFERENCE_CATEGORY_THEME = "theme"
|
||||
PreferenceCategoryTheme = "theme"
|
||||
// the name for theme props is the team id
|
||||
|
||||
PREFERENCE_CATEGORY_AUTHORIZED_OAUTH_APP = "oauth_app"
|
||||
PreferenceCategoryAuthorizedOAuthApp = "oauth_app"
|
||||
// the name for oauth_app is the client_id and value is the current scope
|
||||
|
||||
PREFERENCE_CATEGORY_LAST = "last"
|
||||
PREFERENCE_NAME_LAST_CHANNEL = "channel"
|
||||
PREFERENCE_NAME_LAST_TEAM = "team"
|
||||
PreferenceCategoryLast = "last"
|
||||
PreferenceNameLastChannel = "channel"
|
||||
PreferenceNameLastTeam = "team"
|
||||
|
||||
PREFERENCE_CATEGORY_CUSTOM_STATUS = "custom_status"
|
||||
PREFERENCE_NAME_RECENT_CUSTOM_STATUSES = "recent_custom_statuses"
|
||||
PREFERENCE_NAME_CUSTOM_STATUS_TUTORIAL_STATE = "custom_status_tutorial_state"
|
||||
PreferenceCategoryCustomStatus = "custom_status"
|
||||
PreferenceNameRecentCustomStatuses = "recent_custom_statuses"
|
||||
PreferenceNameCustomStatusTutorialState = "custom_status_tutorial_state"
|
||||
|
||||
PREFERENCE_CUSTOM_STATUS_MODAL_VIEWED = "custom_status_modal_viewed"
|
||||
PreferenceCustomStatusModalViewed = "custom_status_modal_viewed"
|
||||
|
||||
PREFERENCE_CATEGORY_NOTIFICATIONS = "notifications"
|
||||
PREFERENCE_NAME_EMAIL_INTERVAL = "email_interval"
|
||||
PreferenceCategoryNotifications = "notifications"
|
||||
PreferenceNameEmailInterval = "email_interval"
|
||||
|
||||
PREFERENCE_EMAIL_INTERVAL_NO_BATCHING_SECONDS = "30" // the "immediate" setting is actually 30s
|
||||
PREFERENCE_EMAIL_INTERVAL_BATCHING_SECONDS = "900" // fifteen minutes is 900 seconds
|
||||
PREFERENCE_EMAIL_INTERVAL_IMMEDIATELY = "immediately"
|
||||
PREFERENCE_EMAIL_INTERVAL_FIFTEEN = "fifteen"
|
||||
PREFERENCE_EMAIL_INTERVAL_FIFTEEN_AS_SECONDS = "900"
|
||||
PREFERENCE_EMAIL_INTERVAL_HOUR = "hour"
|
||||
PREFERENCE_EMAIL_INTERVAL_HOUR_AS_SECONDS = "3600"
|
||||
PreferenceEmailIntervalNoBatchingSeconds = "30" // the "immediate" setting is actually 30s
|
||||
PreferenceEmailIntervalBatchingSeconds = "900" // fifteen minutes is 900 seconds
|
||||
PreferenceEmailIntervalImmediately = "immediately"
|
||||
PreferenceEmailIntervalFifteen = "fifteen"
|
||||
PreferenceEmailIntervalFifteenAsSeconds = "900"
|
||||
PreferenceEmailIntervalHour = "hour"
|
||||
PreferenceEmailIntervalHourAsSeconds = "3600"
|
||||
)
|
||||
|
||||
type Preference struct {
|
||||
@@ -92,7 +92,7 @@ func (o *Preference) IsValid() *AppError {
|
||||
return NewAppError("Preference.IsValid", "model.preference.is_valid.value.app_error", nil, "value="+o.Value, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if o.Category == PREFERENCE_CATEGORY_THEME {
|
||||
if o.Category == PreferenceCategoryTheme {
|
||||
var unused map[string]string
|
||||
if err := json.NewDecoder(strings.NewReader(o.Value)).Decode(&unused); err != nil {
|
||||
return NewAppError("Preference.IsValid", "model.preference.is_valid.theme.app_error", nil, "value="+o.Value, http.StatusBadRequest)
|
||||
@@ -103,7 +103,7 @@ func (o *Preference) IsValid() *AppError {
|
||||
}
|
||||
|
||||
func (o *Preference) PreUpdate() {
|
||||
if o.Category == PREFERENCE_CATEGORY_THEME {
|
||||
if o.Category == PreferenceCategoryTheme {
|
||||
// decode the value of theme (a map of strings to string) and eliminate any invalid values
|
||||
var props map[string]string
|
||||
if err := json.NewDecoder(strings.NewReader(o.Value)).Decode(&props); err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user