mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add EnableDefaultChannelLeaveJoinMessages config setting (#7961)
This commit is contained in:
committed by
Christopher Speller
parent
dd9ad10d70
commit
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)
|
l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *a.Config().ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages == true {
|
||||||
if requestor == nil {
|
if requestor == nil {
|
||||||
if err := a.postJoinTeamMessage(user, townSquare); err != nil {
|
if err := a.postJoinTeamMessage(user, townSquare); err != nil {
|
||||||
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
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)
|
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
a.InvalidateCacheForChannelMembers(result.Data.(*model.Channel).Id)
|
a.InvalidateCacheForChannelMembers(result.Data.(*model.Channel).Id)
|
||||||
}
|
}
|
||||||
@@ -1012,6 +1014,10 @@ func (a *App) LeaveChannel(channelId string, userId string) *model.AppError {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if channel.Name == model.DEFAULT_CHANNEL && *a.Config().ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages == false {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
a.Go(func() {
|
a.Go(func() {
|
||||||
a.postLeaveChannelMessage(user, channel)
|
a.postLeaveChannelMessage(user, channel)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ func (a *App) trackConfig() {
|
|||||||
"enable_post_search": *cfg.ServiceSettings.EnablePostSearch,
|
"enable_post_search": *cfg.ServiceSettings.EnablePostSearch,
|
||||||
"enable_user_statuses": *cfg.ServiceSettings.EnableUserStatuses,
|
"enable_user_statuses": *cfg.ServiceSettings.EnableUserStatuses,
|
||||||
"close_unused_direct_messages": *cfg.ServiceSettings.CloseUnusedDirectMessages,
|
"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{}{
|
a.SendDiagnostic(TRACK_CONFIG_TEAM, map[string]interface{}{
|
||||||
|
|||||||
@@ -55,7 +55,8 @@
|
|||||||
"ClusterLogTimeoutMilliseconds": 2000,
|
"ClusterLogTimeoutMilliseconds": 2000,
|
||||||
"EnablePreviewFeatures": true,
|
"EnablePreviewFeatures": true,
|
||||||
"CloseUnusedDirectMessages": false,
|
"CloseUnusedDirectMessages": false,
|
||||||
"EnableTutorial": true
|
"EnableTutorial": true,
|
||||||
|
"ExperimentalEnableDefaultChannelLeaveJoinMessages": true
|
||||||
},
|
},
|
||||||
"TeamSettings": {
|
"TeamSettings": {
|
||||||
"SiteName": "Mattermost",
|
"SiteName": "Mattermost",
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ type ServiceSettings struct {
|
|||||||
CloseUnusedDirectMessages *bool
|
CloseUnusedDirectMessages *bool
|
||||||
EnablePreviewFeatures *bool
|
EnablePreviewFeatures *bool
|
||||||
EnableTutorial *bool
|
EnableTutorial *bool
|
||||||
|
ExperimentalEnableDefaultChannelLeaveJoinMessages *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceSettings) SetDefaults() {
|
func (s *ServiceSettings) SetDefaults() {
|
||||||
@@ -413,6 +414,10 @@ func (s *ServiceSettings) SetDefaults() {
|
|||||||
if s.EnablePreviewFeatures == nil {
|
if s.EnablePreviewFeatures == nil {
|
||||||
s.EnablePreviewFeatures = NewBool(true)
|
s.EnablePreviewFeatures = NewBool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.ExperimentalEnableDefaultChannelLeaveJoinMessages == nil {
|
||||||
|
s.ExperimentalEnableDefaultChannelLeaveJoinMessages = NewBool(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClusterSettings struct {
|
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["CloseUnusedDirectMessages"] = strconv.FormatBool(*c.ServiceSettings.CloseUnusedDirectMessages)
|
||||||
props["EnablePreviewFeatures"] = strconv.FormatBool(*c.ServiceSettings.EnablePreviewFeatures)
|
props["EnablePreviewFeatures"] = strconv.FormatBool(*c.ServiceSettings.EnablePreviewFeatures)
|
||||||
props["EnableTutorial"] = strconv.FormatBool(*c.ServiceSettings.EnableTutorial)
|
props["EnableTutorial"] = strconv.FormatBool(*c.ServiceSettings.EnableTutorial)
|
||||||
|
props["ExperimentalEnableDefaultChannelLeaveJoinMessages"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages)
|
||||||
|
|
||||||
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
||||||
props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)
|
props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)
|
||||||
|
|||||||
Reference in New Issue
Block a user