Skip to content

Commit

Permalink
Force lowercase in the name of new rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Aug 24, 2015
1 parent 901dd39 commit 571917c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/views/app/sideNav/createChannelFlex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Template.createChannelFlex.events

'click .save-channel': (e, instance) ->
err = SideNav.validate()
name = instance.find('#channel-name').value
name = instance.find('#channel-name').value.toLowerCase().trim()
instance.roomName.set name
if not err
Meteor.call 'createChannel', name, instance.selectedUsers.get(), (err, result) ->
Expand Down
2 changes: 1 addition & 1 deletion client/views/app/sideNav/privateGroupsFlex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Template.privateGroupsFlex.events

'click .save-pvt-group': (e, instance) ->
err = SideNav.validate()
name = instance.find('#pvt-group-name').value
name = instance.find('#pvt-group-name').value.toLowerCase().trim()
instance.groupName.set name
if not err
Meteor.call 'createPrivateGroup', name, instance.selectedUsers.get(), (err, result) ->
Expand Down
2 changes: 1 addition & 1 deletion server/methods/createChannel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Meteor.methods
if not Meteor.userId()
throw new Meteor.Error 'invalid-user', "[methods] createChannel -> Invalid user"

if not /^[0-9a-z-_]+$/i.test name
if not /^[0-9a-z-_]+$/.test name
throw new Meteor.Error 'name-invalid'

console.log '[methods] createChannel -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
Expand Down
2 changes: 1 addition & 1 deletion server/methods/createPrivateGroup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Meteor.methods

console.log '[methods] createPrivateGroup -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments

if not /^[0-9a-z-_]+$/i.test name
if not /^[0-9a-z-_]+$/.test name
throw new Meteor.Error 'name-invalid'

now = new Date()
Expand Down

0 comments on commit 571917c

Please sign in to comment.