Add internal (not managable from API) webhooks

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-10-29 19:07:54 +02:00 • committed by nicole mikołajczyk
commit 6d46aefb7f
7 changed files with 62 additions and 12 deletions

View file

@ -64,6 +64,20 @@ defmodule Pleroma.Web.AdminAPI.WebhookControllerTest do
assert %{events: [:"report.created", :"account.created"]} = Webhook.get(id)
end
test "can't edit an internal webhook", %{conn: conn} do
%{id: id} =
Webhook.create(%{url: "https://example.com/webhook1", events: [], internal: true})
conn
|> put_req_header("content-type", "application/json")
|> patch("/api/pleroma/admin/webhooks/#{id}", %{
events: ["report.created", "account.created"]
})
|> json_response_and_validate_schema(:forbidden)
assert %{events: []} = Webhook.get(id)
end
end
describe "DELETE /api/pleroma/admin/webhooks" do