summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go
index 30fc2c1b6..54b589175 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -163,6 +163,14 @@ func (a *App) CreateChannelWithUser(channel *model.Channel, userId string) (*mod
// RenameChannel is used to rename the channel Name and the DisplayName fields
func (a *App) RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError) {
+ if channel.Type == model.CHANNEL_DIRECT {
+ return nil, model.NewAppError("RenameChannel", "api.channel.rename_channel.cant_rename_direct_messages.app_error", nil, "", http.StatusBadRequest)
+ }
+
+ if channel.Type == model.CHANNEL_GROUP {
+ return nil, model.NewAppError("RenameChannel", "api.channel.rename_channel.cant_rename_group_messages.app_error", nil, "", http.StatusBadRequest)
+ }
+
channel.Name = newChannelName
if newDisplayName != "" {
channel.DisplayName = newDisplayName