Fix issue with snippet code

This commit is contained in:
Uku Taht 2020-02-26 11:46:28 +02:00
parent 1be43a6ce6
commit 08eba461df
2 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,8 @@ defmodule PlausibleWeb.SiteController do
def add_snippet(conn, %{"website" => website}) do
site = Sites.get_for_user!(conn.assigns[:current_user].id, website)
|> Repo.preload(:custom_domain)
conn
|> assign(:skip_plausible_tracking, true)
|> render("snippet.html", site: site, layout: {PlausibleWeb.LayoutView, "focus.html"})

View File

@ -63,6 +63,16 @@ defmodule PlausibleWeb.SiteControllerTest do
end
end
describe "GET /:website/snippet" do
setup [:create_user, :log_in, :create_site]
test "shows snippet", %{conn: conn, site: site} do
conn = get(conn, "/#{site.domain}/snippet")
assert html_response(conn, 200) =~ "Add javascript snippet"
end
end
describe "GET /:website/settings" do
setup [:create_user, :log_in, :create_site]