Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
aerosol committed Sep 13, 2023
1 parent 0f42b57 commit a4b3e00
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/plausible_web/live/props_settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,21 @@ defmodule PlausibleWeb.Live.PropsSettings do
{:noreply, socket}
end

def handle_info({:prop_allowed, prop}, %{assigns: %{site: site}} = socket)
def handle_info(
{:prop_allowed, prop},
%{assigns: %{site: site}} = socket
)
when is_binary(prop) do
allowed_event_props = [prop | site.allowed_event_props]

socket =
socket
|> assign(
add_prop?: false,
filter_text: "",
all_props: [prop | socket.assigns.all_props],
displayed_props: [prop | socket.assigns.all_props],
site: %{site | allowed_event_props: [prop | site.allowed_event_props]}
all_props: allowed_event_props,
displayed_props: allowed_event_props,
site: %{site | allowed_event_props: allowed_event_props}
)
|> put_flash(:success, "Property added successfully")

Expand Down

0 comments on commit a4b3e00

Please sign in to comment.