Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions web/plugs/analytics_identify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ defmodule CodeCorps.Plug.AnalyticsIdentify do

def init(opts), do: opts

def call(conn, _opts) do
if current_user = conn.assigns[:current_user] do
CodeCorps.Analytics.Segment.identify(current_user)
conn
else
conn
end
def call(conn, _opts), do: conn |> identify

defp identify(%{assigns: %{current_user: user}} = conn) do
CodeCorps.Analytics.Segment.identify(user)
conn
end
defp identify(conn), do: conn
end