Fixes #3453 - Removal of referenced webhooks does not provide error toast within UI
This commit is contained in:
parent
95a6625f05
commit
89c3a5e9c9
3 changed files with 28 additions and 4 deletions
|
@ -15,9 +15,9 @@ class App.ControllerGenericDestroyConfirm extends App.ControllerModal
|
|||
@close()
|
||||
if @callback
|
||||
@callback()
|
||||
options.fail = =>
|
||||
options.fail = (xhr, data) =>
|
||||
@log 'errors'
|
||||
@close()
|
||||
@showAlert(data.human_error || data.error)
|
||||
@item.destroy(options)
|
||||
|
||||
class App.ControllerConfirm extends App.ControllerModal
|
||||
|
|
|
@ -248,12 +248,13 @@ module CommonActions
|
|||
# Executes action inside of modal. Makes sure modal has opened and closes
|
||||
#
|
||||
# @param timeout [Integer] seconds to wait
|
||||
def in_modal(timeout: 4, &block)
|
||||
# @param wait_for_disappear [Bool] wait for modal to close
|
||||
def in_modal(timeout: 4, disappears: true, &block)
|
||||
modal_ready(timeout: timeout)
|
||||
|
||||
within('.modal', &block)
|
||||
|
||||
modal_disappear(timeout: timeout)
|
||||
modal_disappear(timeout: timeout) if disappears
|
||||
end
|
||||
end
|
||||
|
||||
|
|
23
spec/system/manage/webhooks_spec.rb
Normal file
23
spec/system/manage/webhooks_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Manage > Webhook', type: :system do
|
||||
context 'deleting' do
|
||||
let!(:webhook) { create(:webhook) }
|
||||
let!(:trigger) { create(:trigger, perform: { 'notification.webhook' => { 'webhook_id' => webhook.id.to_s } }) }
|
||||
|
||||
it 'referenced webhook shows error message' do
|
||||
visit '/#manage/webhook'
|
||||
|
||||
within :active_content do
|
||||
click '.js-action'
|
||||
click '.js-delete'
|
||||
end
|
||||
|
||||
in_modal disappears: false do
|
||||
click '.js-submit'
|
||||
|
||||
expect(page).to have_text('Cannot delete').and(have_text("##{trigger.id}"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue