Show specific error message when trying to create a channel named like an archived one

pull/1620/head
Matthias Brun 10 years ago
parent 9635fa5d02
commit 982569dc2b
  1. 1
      i18n/en.i18n.json
  2. 3
      packages/rocketchat-ui-sidenav/side-nav/createChannelFlex.coffee
  3. 6
      packages/rocketchat-ui-sidenav/side-nav/createChannelFlex.html
  4. 5
      server/methods/createChannel.coffee

@ -134,6 +134,7 @@
"Disable_New_Message_Notification" : "Disable New Message Notification",
"Disable_New_Room_Notification" : "Disable New Room Notification",
"Drop_to_upload_file" : "Drop to upload file",
"Duplicate_archived_channel_name" : "An archived Channel with name '%s' exists",
"Duplicate_channel_name" : "A Channel with name '%s' exists",
"Duplicate_private_group_name" : "A Private Group with name '%s' exists",
"E-mail" : "E-mail",

@ -90,6 +90,9 @@ Template.createChannelFlex.events
if err.error is 'duplicate-name'
instance.error.set({ duplicate: true })
return
if err.error is 'archived-duplicate-name'
instance.error.set({ archivedduplicate: true })
return
else
return toastr.error err.reason

@ -40,6 +40,12 @@
{{{_ "Duplicate_channel_name" roomName}}}
</div>
{{/if}}
{{#if error.archivedduplicate}}
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Duplicate_archived_channel_name" roomName}}}
</div>
{{/if}}
<div class="input-submit">
<button class="button clean primary save-channel">{{_ "Save" }}</button>
<button class="button clean cancel-channel">{{_ "Cancel" }}</button>

@ -23,7 +23,10 @@ Meteor.methods
# avoid duplicate names
if RocketChat.models.Rooms.findOneByName name
throw new Meteor.Error 'duplicate-name'
if RocketChat.models.Rooms.findOneByName(name).archived
throw new Meteor.Error 'archived-duplicate-name'
else
throw new Meteor.Error 'duplicate-name'
# name = s.slugify name

Loading…
Cancel
Save