Skip to content
Snippets Groups Projects
Commit ffeeded2 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Close #1923; Prevent erros update outgoing webhooks with empty channel

parent e68dacdf
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,12 @@ Meteor.methods ...@@ -17,7 +17,12 @@ Meteor.methods
if integration.urls.length is 0 if integration.urls.length is 0
throw new Meteor.Error 'invalid_urls', '[methods] updateOutgoingIntegration -> urls is required' throw new Meteor.Error 'invalid_urls', '[methods] updateOutgoingIntegration -> urls is required'
if integration.channel?.trim() isnt '' and integration.channel[0] not in ['@', '#'] if _.isString(integration.channel)
integration.channel = integration.channel.trim()
else
integration.channel = undefined
if integration.channel? and integration.channel[0] not in ['@', '#']
throw new Meteor.Error 'invalid_channel', '[methods] updateOutgoingIntegration -> channel should start with # or @' throw new Meteor.Error 'invalid_channel', '[methods] updateOutgoingIntegration -> channel should start with # or @'
if not integration.token? or integration.token?.trim() is '' if not integration.token? or integration.token?.trim() is ''
...@@ -36,7 +41,7 @@ Meteor.methods ...@@ -36,7 +41,7 @@ Meteor.methods
throw new Meteor.Error 'invalid_integration', '[methods] updateOutgoingIntegration -> integration not found' throw new Meteor.Error 'invalid_integration', '[methods] updateOutgoingIntegration -> integration not found'
if integration.channel?.trim() isnt '' if integration.channel?
record = undefined record = undefined
channelType = integration.channel[0] channelType = integration.channel[0]
channel = integration.channel.substr(1) channel = integration.channel.substr(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment