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)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user