Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Этот коммит содержится в:
@@ -244,32 +244,33 @@ func (a *App) trackConfig() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||||
"enable_user_creation": *cfg.TeamSettings.EnableUserCreation,
|
"enable_user_creation": cfg.TeamSettings.EnableUserCreation,
|
||||||
"enable_team_creation": *cfg.TeamSettings.EnableTeamCreation,
|
"enable_team_creation": *cfg.TeamSettings.EnableTeamCreation,
|
||||||
"restrict_team_invite": *cfg.TeamSettings.RestrictTeamInvite,
|
"restrict_team_invite": *cfg.TeamSettings.RestrictTeamInvite,
|
||||||
"restrict_public_channel_creation": *cfg.TeamSettings.RestrictPublicChannelCreation,
|
"restrict_public_channel_creation": *cfg.TeamSettings.RestrictPublicChannelCreation,
|
||||||
"restrict_private_channel_creation": *cfg.TeamSettings.RestrictPrivateChannelCreation,
|
"restrict_private_channel_creation": *cfg.TeamSettings.RestrictPrivateChannelCreation,
|
||||||
"restrict_public_channel_management": *cfg.TeamSettings.RestrictPublicChannelManagement,
|
"restrict_public_channel_management": *cfg.TeamSettings.RestrictPublicChannelManagement,
|
||||||
"restrict_private_channel_management": *cfg.TeamSettings.RestrictPrivateChannelManagement,
|
"restrict_private_channel_management": *cfg.TeamSettings.RestrictPrivateChannelManagement,
|
||||||
"restrict_public_channel_deletion": *cfg.TeamSettings.RestrictPublicChannelDeletion,
|
"restrict_public_channel_deletion": *cfg.TeamSettings.RestrictPublicChannelDeletion,
|
||||||
"restrict_private_channel_deletion": *cfg.TeamSettings.RestrictPrivateChannelDeletion,
|
"restrict_private_channel_deletion": *cfg.TeamSettings.RestrictPrivateChannelDeletion,
|
||||||
"enable_open_server": *cfg.TeamSettings.EnableOpenServer,
|
"enable_open_server": *cfg.TeamSettings.EnableOpenServer,
|
||||||
"enable_custom_brand": *cfg.TeamSettings.EnableCustomBrand,
|
"enable_custom_brand": *cfg.TeamSettings.EnableCustomBrand,
|
||||||
"restrict_direct_message": *cfg.TeamSettings.RestrictDirectMessage,
|
"restrict_direct_message": *cfg.TeamSettings.RestrictDirectMessage,
|
||||||
"max_notifications_per_channel": *cfg.TeamSettings.MaxNotificationsPerChannel,
|
"max_notifications_per_channel": *cfg.TeamSettings.MaxNotificationsPerChannel,
|
||||||
"enable_confirm_notifications_to_channel": *cfg.TeamSettings.EnableConfirmNotificationsToChannel,
|
"enable_confirm_notifications_to_channel": *cfg.TeamSettings.EnableConfirmNotificationsToChannel,
|
||||||
"max_users_per_team": *cfg.TeamSettings.MaxUsersPerTeam,
|
"max_users_per_team": *cfg.TeamSettings.MaxUsersPerTeam,
|
||||||
"max_channels_per_team": *cfg.TeamSettings.MaxChannelsPerTeam,
|
"max_channels_per_team": *cfg.TeamSettings.MaxChannelsPerTeam,
|
||||||
"teammate_name_display": *cfg.TeamSettings.TeammateNameDisplay,
|
"teammate_name_display": *cfg.TeamSettings.TeammateNameDisplay,
|
||||||
"isdefault_site_name": isDefault(cfg.TeamSettings.SiteName, "Mattermost"),
|
"isdefault_site_name": isDefault(cfg.TeamSettings.SiteName, "Mattermost"),
|
||||||
"isdefault_custom_brand_text": isDefault(*cfg.TeamSettings.CustomBrandText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_BRAND_TEXT),
|
"isdefault_custom_brand_text": isDefault(*cfg.TeamSettings.CustomBrandText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_BRAND_TEXT),
|
||||||
"isdefault_custom_description_text": isDefault(*cfg.TeamSettings.CustomDescriptionText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT),
|
"isdefault_custom_description_text": isDefault(*cfg.TeamSettings.CustomDescriptionText, model.TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT),
|
||||||
"isdefault_user_status_away_timeout": isDefault(*cfg.TeamSettings.UserStatusAwayTimeout, model.TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT),
|
"isdefault_user_status_away_timeout": isDefault(*cfg.TeamSettings.UserStatusAwayTimeout, model.TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT),
|
||||||
"restrict_private_channel_manage_members": *cfg.TeamSettings.RestrictPrivateChannelManageMembers,
|
"restrict_private_channel_manage_members": *cfg.TeamSettings.RestrictPrivateChannelManageMembers,
|
||||||
"enable_X_to_leave_channels_from_LHS": *cfg.TeamSettings.EnableXToLeaveChannelsFromLHS,
|
"enable_X_to_leave_channels_from_LHS": *cfg.TeamSettings.EnableXToLeaveChannelsFromLHS,
|
||||||
"experimental_enable_automatic_replies": *cfg.TeamSettings.ExperimentalEnableAutomaticReplies,
|
"experimental_enable_automatic_replies": *cfg.TeamSettings.ExperimentalEnableAutomaticReplies,
|
||||||
"experimental_town_square_is_read_only": *cfg.TeamSettings.ExperimentalTownSquareIsReadOnly,
|
"experimental_town_square_is_hidden_in_lhs": *cfg.TeamSettings.ExperimentalHideTownSquareinLHS,
|
||||||
"experimental_primary_team": isDefault(*cfg.TeamSettings.ExperimentalPrimaryTeam, ""),
|
"experimental_town_square_is_read_only": *cfg.TeamSettings.ExperimentalTownSquareIsReadOnly,
|
||||||
|
"experimental_primary_team": isDefault(*cfg.TeamSettings.ExperimentalPrimaryTeam, ""),
|
||||||
})
|
})
|
||||||
|
|
||||||
a.SendDiagnostic(TRACK_CONFIG_CLIENT_REQ, map[string]interface{}{
|
a.SendDiagnostic(TRACK_CONFIG_CLIENT_REQ, map[string]interface{}{
|
||||||
|
|||||||
@@ -79,9 +79,8 @@ type UserImportData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UserNotifyPropsImportData struct {
|
type UserNotifyPropsImportData struct {
|
||||||
Desktop *string `json:"desktop"`
|
Desktop *string `json:"desktop"`
|
||||||
DesktopDuration *string `json:"desktop_duration"`
|
DesktopSound *string `json:"desktop_sound"`
|
||||||
DesktopSound *string `json:"desktop_sound"`
|
|
||||||
|
|
||||||
Email *string `json:"email"`
|
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 data.NotifyProps.DesktopSound != nil {
|
||||||
if value, ok := user.NotifyProps[model.DESKTOP_SOUND_NOTIFY_PROP]; !ok || value != *data.NotifyProps.DesktopSound {
|
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)
|
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)
|
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) {
|
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)
|
return model.NewAppError("BulkImport", "app.import.validate_user_import_data.notify_props_desktop_sound_invalid.error", nil, "", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,10 +430,6 @@ func TestImportValidateUserImportData(t *testing.T) {
|
|||||||
checkError(t, validateUserImportData(&data))
|
checkError(t, validateUserImportData(&data))
|
||||||
|
|
||||||
data.NotifyProps.Desktop = ptrStr(model.USER_NOTIFY_ALL)
|
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")
|
data.NotifyProps.DesktopSound = ptrStr("invalid")
|
||||||
checkError(t, validateUserImportData(&data))
|
checkError(t, validateUserImportData(&data))
|
||||||
|
|
||||||
@@ -1980,7 +1976,6 @@ func TestImportImportUser(t *testing.T) {
|
|||||||
// Set Notify Props
|
// Set Notify Props
|
||||||
data.NotifyProps = &UserNotifyPropsImportData{
|
data.NotifyProps = &UserNotifyPropsImportData{
|
||||||
Desktop: ptrStr(model.USER_NOTIFY_ALL),
|
Desktop: ptrStr(model.USER_NOTIFY_ALL),
|
||||||
DesktopDuration: ptrStr("5"),
|
|
||||||
DesktopSound: ptrStr("true"),
|
DesktopSound: ptrStr("true"),
|
||||||
Email: ptrStr("true"),
|
Email: ptrStr("true"),
|
||||||
Mobile: ptrStr(model.USER_NOTIFY_ALL),
|
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_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.DESKTOP_SOUND_NOTIFY_PROP, "true")
|
||||||
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "true")
|
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "true")
|
||||||
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_ALL)
|
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_ALL)
|
||||||
@@ -2011,7 +2005,6 @@ func TestImportImportUser(t *testing.T) {
|
|||||||
// Change Notify Props
|
// Change Notify Props
|
||||||
data.NotifyProps = &UserNotifyPropsImportData{
|
data.NotifyProps = &UserNotifyPropsImportData{
|
||||||
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
|
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
|
||||||
DesktopDuration: ptrStr("3"),
|
|
||||||
DesktopSound: ptrStr("false"),
|
DesktopSound: ptrStr("false"),
|
||||||
Email: ptrStr("false"),
|
Email: ptrStr("false"),
|
||||||
Mobile: ptrStr(model.USER_NOTIFY_NONE),
|
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_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.DESKTOP_SOUND_NOTIFY_PROP, "false")
|
||||||
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
|
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
|
||||||
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
|
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
|
||||||
@@ -2047,7 +2039,6 @@ func TestImportImportUser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
data.NotifyProps = &UserNotifyPropsImportData{
|
data.NotifyProps = &UserNotifyPropsImportData{
|
||||||
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
|
Desktop: ptrStr(model.USER_NOTIFY_MENTION),
|
||||||
DesktopDuration: ptrStr("3"),
|
|
||||||
DesktopSound: ptrStr("false"),
|
DesktopSound: ptrStr("false"),
|
||||||
Email: ptrStr("false"),
|
Email: ptrStr("false"),
|
||||||
Mobile: ptrStr(model.USER_NOTIFY_NONE),
|
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_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.DESKTOP_SOUND_NOTIFY_PROP, "false")
|
||||||
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
|
checkNotifyProp(t, user, model.EMAIL_NOTIFY_PROP, "false")
|
||||||
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
|
checkNotifyProp(t, user, model.PUSH_NOTIFY_PROP, model.USER_NOTIFY_NONE)
|
||||||
|
|||||||
@@ -91,6 +91,7 @@
|
|||||||
"EnableConfirmNotificationsToChannel": true,
|
"EnableConfirmNotificationsToChannel": true,
|
||||||
"TeammateNameDisplay": "username",
|
"TeammateNameDisplay": "username",
|
||||||
"ExperimentalEnableAutomaticReplies": false,
|
"ExperimentalEnableAutomaticReplies": false,
|
||||||
|
"ExperimentalHideTownSquareinLHS": false,
|
||||||
"ExperimentalTownSquareIsReadOnly": false,
|
"ExperimentalTownSquareIsReadOnly": false,
|
||||||
"ExperimentalPrimaryTeam": ""
|
"ExperimentalPrimaryTeam": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3790,10 +3790,6 @@
|
|||||||
"id": "app.import.validate_user_import_data.notify_props_comment_trigger_invalid.error",
|
"id": "app.import.validate_user_import_data.notify_props_comment_trigger_invalid.error",
|
||||||
"translation": "Invalid Comment Trigger Notify Prop for user."
|
"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",
|
"id": "app.import.validate_user_import_data.notify_props_desktop_invalid.error",
|
||||||
"translation": "Invalid Desktop Notify Prop value for user."
|
"translation": "Invalid Desktop Notify Prop value for user."
|
||||||
|
|||||||
@@ -1022,6 +1022,7 @@ type TeamSettings struct {
|
|||||||
EnableConfirmNotificationsToChannel *bool
|
EnableConfirmNotificationsToChannel *bool
|
||||||
TeammateNameDisplay *string
|
TeammateNameDisplay *string
|
||||||
ExperimentalEnableAutomaticReplies *bool
|
ExperimentalEnableAutomaticReplies *bool
|
||||||
|
ExperimentalHideTownSquareinLHS *bool
|
||||||
ExperimentalTownSquareIsReadOnly *bool
|
ExperimentalTownSquareIsReadOnly *bool
|
||||||
ExperimentalPrimaryTeam *string
|
ExperimentalPrimaryTeam *string
|
||||||
}
|
}
|
||||||
@@ -1120,6 +1121,10 @@ func (s *TeamSettings) SetDefaults() {
|
|||||||
s.ExperimentalEnableAutomaticReplies = NewBool(false)
|
s.ExperimentalEnableAutomaticReplies = NewBool(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.ExperimentalHideTownSquareinLHS == nil {
|
||||||
|
s.ExperimentalHideTownSquareinLHS = NewBool(false)
|
||||||
|
}
|
||||||
|
|
||||||
if s.ExperimentalTownSquareIsReadOnly == nil {
|
if s.ExperimentalTownSquareIsReadOnly == nil {
|
||||||
s.ExperimentalTownSquareIsReadOnly = NewBool(false)
|
s.ExperimentalTownSquareIsReadOnly = NewBool(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const (
|
|||||||
USER_NOTIFY_NONE = "none"
|
USER_NOTIFY_NONE = "none"
|
||||||
DESKTOP_NOTIFY_PROP = "desktop"
|
DESKTOP_NOTIFY_PROP = "desktop"
|
||||||
DESKTOP_SOUND_NOTIFY_PROP = "desktop_sound"
|
DESKTOP_SOUND_NOTIFY_PROP = "desktop_sound"
|
||||||
DESKTOP_DURATION_NOTIFY_PROP = "desktop_duration"
|
|
||||||
MARK_UNREAD_NOTIFY_PROP = "mark_unread"
|
MARK_UNREAD_NOTIFY_PROP = "mark_unread"
|
||||||
PUSH_NOTIFY_PROP = "push"
|
PUSH_NOTIFY_PROP = "push"
|
||||||
PUSH_STATUS_NOTIFY_PROP = "push_status"
|
PUSH_STATUS_NOTIFY_PROP = "push_status"
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
|||||||
props["RunJobs"] = strconv.FormatBool(*c.JobSettings.RunJobs)
|
props["RunJobs"] = strconv.FormatBool(*c.JobSettings.RunJobs)
|
||||||
|
|
||||||
// Set default values for all options that require a license.
|
// Set default values for all options that require a license.
|
||||||
|
props["ExperimentalHideTownSquareinLHS"] = "false"
|
||||||
props["ExperimentalTownSquareIsReadOnly"] = "false"
|
props["ExperimentalTownSquareIsReadOnly"] = "false"
|
||||||
props["ExperimentalEnableAuthenticationTransfer"] = "true"
|
props["ExperimentalEnableAuthenticationTransfer"] = "true"
|
||||||
props["EnableCustomBrand"] = "false"
|
props["EnableCustomBrand"] = "false"
|
||||||
@@ -611,6 +612,7 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
|
|||||||
props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
|
props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
|
||||||
|
|
||||||
if license != nil {
|
if license != nil {
|
||||||
|
props["ExperimentalHideTownSquareinLHS"] = strconv.FormatBool(*c.TeamSettings.ExperimentalHideTownSquareinLHS)
|
||||||
props["ExperimentalTownSquareIsReadOnly"] = strconv.FormatBool(*c.TeamSettings.ExperimentalTownSquareIsReadOnly)
|
props["ExperimentalTownSquareIsReadOnly"] = strconv.FormatBool(*c.TeamSettings.ExperimentalTownSquareIsReadOnly)
|
||||||
props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
|
props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user