mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
UX: show if webhook is disabled (#7217)
+ show in staff logs when webhook is created/updated/destroyed
This commit is contained in:
@ -34,6 +34,7 @@ describe Admin::WebHooksController do
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json["web_hook"]["payload_url"]).to eq("https://meta.discourse.org/")
|
||||
expect(UserHistory.where(acting_user_id: admin.id, action: UserHistory.actions[:web_hook_create]).count).to eq(1)
|
||||
end
|
||||
|
||||
it 'returns error when field is not filled correctly' do
|
||||
@ -57,6 +58,30 @@ describe Admin::WebHooksController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
it "logs webhook update" do
|
||||
put "/admin/api/web_hooks/#{web_hook.id}.json", params: {
|
||||
web_hook: { active: false, payload_url: "https://test.com" }
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(UserHistory.where(acting_user_id: admin.id,
|
||||
action: UserHistory.actions[:web_hook_update],
|
||||
new_value: "payload_url: https://test.com, active: false").exists?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#destroy' do
|
||||
it "logs webhook destroy" do
|
||||
delete "/admin/api/web_hooks/#{web_hook.id}.json", params: {
|
||||
web_hook: { active: false, payload_url: "https://test.com" }
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(UserHistory.where(acting_user_id: admin.id, action: UserHistory.actions[:web_hook_destroy]).exists?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#ping' do
|
||||
it 'enqueues the ping event' do
|
||||
expect do
|
||||
|
Reference in New Issue
Block a user