feat: Remove restrictions on API channel webhook_url (#2261)

This commit is contained in:
Pranav Raj S
2021-05-13 15:03:25 +05:30
committed by GitHub
parent 35f8d01a0c
commit 836b317b8a
6 changed files with 50 additions and 8 deletions

View File

@@ -56,7 +56,8 @@ import { required } from 'vuelidate/lib/validators';
import router from '../../../../index';
import PageHeader from '../../SettingsSubPageHeader';
const shouldBeWebhookUrl = (value = '') => value.startsWith('http');
const shouldBeWebhookUrl = (value = '') =>
value ? value.startsWith('http') : true;
export default {
components: {
@@ -76,7 +77,7 @@ export default {
},
validations: {
channelName: { required },
webhookUrl: { required, shouldBeWebhookUrl },
webhookUrl: { shouldBeWebhookUrl },
},
methods: {
async createChannel() {

View File

@@ -59,7 +59,9 @@ class WebhookListener < BaseListener
WebhookJob.perform_later(webhook.url, payload)
end
# Deliver for API Inbox
WebhookJob.perform_later(inbox.channel.webhook_url, payload) if inbox.channel_type == 'Channel::Api'
return unless inbox.channel_type == 'Channel::Api'
return if inbox.channel.webhook_url.blank?
WebhookJob.perform_later(inbox.channel.webhook_url, payload)
end
end

View File

@@ -3,7 +3,7 @@
# Table name: channel_api
#
# id :bigint not null, primary key
# webhook_url :string not null
# webhook_url :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer not null