Adds a feature flag to control availability of DMs in shared channels (#28920)
* Adds a feature flag to control availability of DMs in shared channels * Reverse feature flag wording
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6075b1cd4e
Коммит
cb03009992
@@ -424,7 +424,7 @@ func (a *App) createDirectChannel(c request.CTX, userID string, otherUserID stri
|
||||
}
|
||||
|
||||
func (a *App) createDirectChannelWithUser(c request.CTX, user, otherUser *model.User, channelOptions ...model.ChannelOption) (*model.Channel, *model.AppError) {
|
||||
if user.IsRemote() || otherUser.IsRemote() {
|
||||
if !a.Config().FeatureFlags.EnableSharedChannelsDMs && (user.IsRemote() || otherUser.IsRemote()) {
|
||||
return nil, model.NewAppError("createDirectChannelWithUser", "api.channel.create_channel.direct_channel.remote_restricted.app_error", nil, "", http.StatusForbidden)
|
||||
}
|
||||
|
||||
@@ -528,9 +528,11 @@ func (a *App) createGroupChannel(c request.CTX, userIDs []string) (*model.Channe
|
||||
return nil, model.NewAppError("CreateGroupChannel", "api.channel.create_group.bad_user.app_error", nil, "user_ids="+model.ArrayToJSON(userIDs), http.StatusBadRequest)
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
if user.IsRemote() {
|
||||
return nil, model.NewAppError("createGroupChannel", "api.channel.create_group.remote_restricted.app_error", nil, "", http.StatusForbidden)
|
||||
if !a.Config().FeatureFlags.EnableSharedChannelsDMs {
|
||||
for _, user := range users {
|
||||
if user.IsRemote() {
|
||||
return nil, model.NewAppError("createGroupChannel", "api.channel.create_group.remote_restricted.app_error", nil, "", http.StatusForbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ func (a *App) deduplicateCreatePost(rctx request.CTX, post *model.Post) (foundPo
|
||||
}
|
||||
|
||||
func (a *App) CreatePost(c request.CTX, post *model.Post, channel *model.Channel, flags model.CreatePostFlags) (savedPost *model.Post, err *model.AppError) {
|
||||
if channel.IsShared() && (channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup) {
|
||||
if !a.Config().FeatureFlags.EnableSharedChannelsDMs && channel.IsShared() && (channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup) {
|
||||
return nil, model.NewAppError("CreatePost", "app.post.create_post.shared_dm_or_gm.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func (scs *Service) ShareChannel(sc *model.SharedChannel) (*model.SharedChannel,
|
||||
return nil, fmt.Errorf("cannot fetch channel while sharing channel %s: %w", sc.ChannelId, err)
|
||||
}
|
||||
|
||||
if channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup {
|
||||
if !scs.server.Config().FeatureFlags.EnableSharedChannelsDMs && (channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup) {
|
||||
return nil, errors.New("cannot share a direct or group channel")
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ type FeatureFlags struct {
|
||||
// Enable the remote cluster service for shared channels.
|
||||
EnableRemoteClusterService bool
|
||||
|
||||
// Enable DMs and GMs for shared channels.
|
||||
EnableSharedChannelsDMs bool
|
||||
|
||||
// AppsEnabled toggles the Apps framework functionalities both in server and client side
|
||||
AppsEnabled bool
|
||||
|
||||
@@ -58,6 +61,7 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.TestFeature = "off"
|
||||
f.TestBoolFeature = false
|
||||
f.EnableRemoteClusterService = false
|
||||
f.EnableSharedChannelsDMs = false
|
||||
f.AppsEnabled = false
|
||||
f.NormalizeLdapDNs = false
|
||||
f.DeprecateCloudFree = false
|
||||
|
||||
Ссылка в новой задаче
Block a user