Add EnableDefaultChannelLeaveJoinMessages config setting (#7961)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
dd9ad10d70
Коммит
0a9200c35d
@@ -63,6 +63,7 @@ func (a *App) JoinDefaultChannels(teamId string, user *model.User, channelRole s
|
||||
l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages == true {
|
||||
if requestor == nil {
|
||||
if err := a.postJoinTeamMessage(user, townSquare); err != nil {
|
||||
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
||||
@@ -72,6 +73,7 @@ func (a *App) JoinDefaultChannels(teamId string, user *model.User, channelRole s
|
||||
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a.InvalidateCacheForChannelMembers(result.Data.(*model.Channel).Id)
|
||||
}
|
||||
@@ -1012,6 +1014,10 @@ func (a *App) LeaveChannel(channelId string, userId string) *model.AppError {
|
||||
return err
|
||||
}
|
||||
|
||||
if channel.Name == model.DEFAULT_CHANNEL && *a.Config().ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages == false {
|
||||
return nil
|
||||
}
|
||||
|
||||
a.Go(func() {
|
||||
a.postLeaveChannelMessage(user, channel)
|
||||
})
|
||||
|
||||
@@ -237,6 +237,7 @@ func (a *App) trackConfig() {
|
||||
"enable_post_search": *cfg.ServiceSettings.EnablePostSearch,
|
||||
"enable_user_statuses": *cfg.ServiceSettings.EnableUserStatuses,
|
||||
"close_unused_direct_messages": *cfg.ServiceSettings.CloseUnusedDirectMessages,
|
||||
"experimental_enable_default_channel_leave_join_messages": *cfg.ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages,
|
||||
})
|
||||
|
||||
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||
|
||||
@@ -55,7 +55,8 @@
|
||||
"ClusterLogTimeoutMilliseconds": 2000,
|
||||
"EnablePreviewFeatures": true,
|
||||
"CloseUnusedDirectMessages": false,
|
||||
"EnableTutorial": true
|
||||
"EnableTutorial": true,
|
||||
"ExperimentalEnableDefaultChannelLeaveJoinMessages": true
|
||||
},
|
||||
"TeamSettings": {
|
||||
"SiteName": "Mattermost",
|
||||
|
||||
@@ -213,6 +213,7 @@ type ServiceSettings struct {
|
||||
CloseUnusedDirectMessages *bool
|
||||
EnablePreviewFeatures *bool
|
||||
EnableTutorial *bool
|
||||
ExperimentalEnableDefaultChannelLeaveJoinMessages *bool
|
||||
}
|
||||
|
||||
func (s *ServiceSettings) SetDefaults() {
|
||||
@@ -413,6 +414,10 @@ func (s *ServiceSettings) SetDefaults() {
|
||||
if s.EnablePreviewFeatures == nil {
|
||||
s.EnablePreviewFeatures = NewBool(true)
|
||||
}
|
||||
|
||||
if s.ExperimentalEnableDefaultChannelLeaveJoinMessages == nil {
|
||||
s.ExperimentalEnableDefaultChannelLeaveJoinMessages = NewBool(true)
|
||||
}
|
||||
}
|
||||
|
||||
type ClusterSettings struct {
|
||||
|
||||
@@ -475,6 +475,7 @@ func GenerateClientConfig(c *model.Config, diagnosticId string) map[string]strin
|
||||
props["CloseUnusedDirectMessages"] = strconv.FormatBool(*c.ServiceSettings.CloseUnusedDirectMessages)
|
||||
props["EnablePreviewFeatures"] = strconv.FormatBool(*c.ServiceSettings.EnablePreviewFeatures)
|
||||
props["EnableTutorial"] = strconv.FormatBool(*c.ServiceSettings.EnableTutorial)
|
||||
props["ExperimentalEnableDefaultChannelLeaveJoinMessages"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages)
|
||||
|
||||
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
||||
props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)
|
||||
|
||||
Ссылка в новой задаче
Block a user