diff options
Diffstat (limited to 'lib/web')
-rw-r--r-- | lib/web/context_plug.ex | 6 | ||||
-rw-r--r-- | lib/web/controllers/alcoolog_controller.ex | 14 | ||||
-rw-r--r-- | lib/web/controllers/open_id_controller.ex | 6 | ||||
-rw-r--r-- | lib/web/controllers/page_controller.ex | 6 | ||||
-rw-r--r-- | lib/web/controllers/untappd_controller.ex | 4 | ||||
-rw-r--r-- | lib/web/live/chat_live.ex | 6 |
6 files changed, 21 insertions, 21 deletions
diff --git a/lib/web/context_plug.ex b/lib/web/context_plug.ex index ebededa..7289763 100644 --- a/lib/web/context_plug.ex +++ b/lib/web/context_plug.ex @@ -9,7 +9,7 @@ defmodule NolaWeb.ContextPlug do def get_account(conn) do cond do get_session(conn, :account) -> get_session(conn, :account) - get_session(conn, :oidc_id) -> if account = IRC.Account.find_meta_account("identity-id", get_session(conn, :oidc_id)), do: account.id + get_session(conn, :oidc_id) -> if account = Nola.Account.find_meta_account("identity-id", get_session(conn, :oidc_id)), do: account.id true -> nil end end @@ -17,7 +17,7 @@ defmodule NolaWeb.ContextPlug do def call(conn, opts) do account = with \ {:account, account_id} when is_binary(account_id) <- {:account, get_account(conn)}, - {:account, account} when not is_nil(account) <- {:account, IRC.Account.get(account_id)} + {:account, account} when not is_nil(account) <- {:account, Nola.Account.get(account_id)} do account else @@ -27,7 +27,7 @@ defmodule NolaWeb.ContextPlug do network = Map.get(conn.params, "network") network = if network == "-", do: nil, else: network - oidc_account = IRC.Account.find_meta_account("identity-id", get_session(conn, :oidc_id)) + oidc_account = Nola.Account.find_meta_account("identity-id", get_session(conn, :oidc_id)) conns = IRC.Connection.get_network(network) chan = if c = Map.get(conn.params, "chan") do diff --git a/lib/web/controllers/alcoolog_controller.ex b/lib/web/controllers/alcoolog_controller.ex index 3c812c5..dc09517 100644 --- a/lib/web/controllers/alcoolog_controller.ex +++ b/lib/web/controllers/alcoolog_controller.ex @@ -17,7 +17,7 @@ defmodule NolaWeb.AlcoologController do end def nick(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) days = String.to_integer(Map.get(params, "days", "180")) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do @@ -47,7 +47,7 @@ defmodule NolaWeb.AlcoologController do end def nick_stats_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do stats = Nola.Plugins.Alcoolog.get_full_statistics(profile_account.id) @@ -63,7 +63,7 @@ defmodule NolaWeb.AlcoologController do end def nick_gls_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do @@ -97,7 +97,7 @@ defmodule NolaWeb.AlcoologController do def nick_volumes_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do @@ -129,7 +129,7 @@ defmodule NolaWeb.AlcoologController do end def nick_log_json(conn = %{assigns: %{account: account}}, %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.Plugins.Alcoolog.nick_history(profile_account) do @@ -160,7 +160,7 @@ defmodule NolaWeb.AlcoologController do end def nick_history_json(conn = %{assigns: %{account: account}}, %{"network" => network, "nick" => nick}) do - profile_account = IRC.Account.find_always_by_nick(network, nick, nick) + profile_account = Nola.Account.find_always_by_nick(network, nick, nick) friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) if friend? do history = for {_, date, value} <- Nola.Plugs.AlcoologAnnouncer.log(profile_account) do @@ -300,7 +300,7 @@ defmodule NolaWeb.AlcoologController do end def minisync(conn, %{"user_id" => user_id, "key" => key, "value" => value}) do - account = IRC.Account.get(user_id) + account = Nola.Account.get(user_id) if account do ds = Nola.Plugins.Alcoolog.data_state() meta = Nola.Plugins.Alcoolog.get_user_meta(ds, account.id) diff --git a/lib/web/controllers/open_id_controller.ex b/lib/web/controllers/open_id_controller.ex index d3fef5d..24dc1a5 100644 --- a/lib/web/controllers/open_id_controller.ex +++ b/lib/web/controllers/open_id_controller.ex @@ -22,10 +22,10 @@ defmodule NolaWeb.OpenIdController do {:ok, %{"sub" => id, "preferred_username" => username}} <- Jason.decode(body) do if account = conn.assigns.account do - if !IRC.Account.get_meta(account, "identity-id") do # XXX: And oidc id not linked yet - IRC.Account.put_meta(account, "identity-id", id) + if !Nola.Account.get_meta(account, "identity-id") do # XXX: And oidc id not linked yet + Nola.Account.put_meta(account, "identity-id", id) end - IRC.Account.put_meta(account, "identity-username", username) + Nola.Account.put_meta(account, "identity-username", username) conn else conn diff --git a/lib/web/controllers/page_controller.ex b/lib/web/controllers/page_controller.ex index 2ac4d0a..c5d0a57 100644 --- a/lib/web/controllers/page_controller.ex +++ b/lib/web/controllers/page_controller.ex @@ -25,8 +25,8 @@ defmodule NolaWeb.PageController do def index(conn = %{assigns: %{account: account}}, _) do memberships = IRC.Membership.of_account(account) users = IRC.UserTrack.find_by_account(account) - metas = IRC.Account.get_all_meta(account) - predicates = IRC.Account.get_predicates(account) + metas = Nola.Account.get_all_meta(account) + predicates = Nola.Account.get_predicates(account) conn |> assign(:title, account.name) |> render("user.html", users: users, memberships: memberships, metas: metas, predicates: predicates) @@ -42,7 +42,7 @@ defmodule NolaWeb.PageController do def authenticate(conn, _) do with \ {:account, account_id} when is_binary(account_id) <- {:account, get_session(conn, :account)}, - {:account, account} when not is_nil(account) <- {:account, IRC.Account.get(account_id)} + {:account, account} when not is_nil(account) <- {:account, Nola.Account.get(account_id)} do assign(conn, :account, account) else diff --git a/lib/web/controllers/untappd_controller.ex b/lib/web/controllers/untappd_controller.ex index d3a540d..e2e1596 100644 --- a/lib/web/controllers/untappd_controller.ex +++ b/lib/web/controllers/untappd_controller.ex @@ -4,10 +4,10 @@ defmodule NolaWeb.UntappdController do def callback(conn, %{"code" => code}) do with \ {:account, account_id} when is_binary(account_id) <- {:account, get_session(conn, :account)}, - {:account, account} when not is_nil(account) <- {:account, IRC.Account.get(account_id)}, + {:account, account} when not is_nil(account) <- {:account, Nola.Account.get(account_id)}, {:ok, auth_token} <- Untappd.auth_callback(code) do - IRC.Account.put_meta(account, "untappd-token", auth_token) + Nola.Account.put_meta(account, "untappd-token", auth_token) text(conn, "OK!") else {:account, _} -> text(conn, "Error: account not found") diff --git a/lib/web/live/chat_live.ex b/lib/web/live/chat_live.ex index 88afa0b..0513cc2 100644 --- a/lib/web/live/chat_live.ex +++ b/lib/web/live/chat_live.ex @@ -6,8 +6,8 @@ defmodule NolaWeb.ChatLive do def mount(%{"network" => network, "chan" => chan}, %{"account" => account_id}, socket) do chan = NolaWeb.reformat_chan(chan) connection = IRC.Connection.get_network(network, chan) - account = IRC.Account.get(account_id) - membership = IRC.Membership.of_account(IRC.Account.get("DRgpD4fLf8PDJMLp8Dtb")) + account = Nola.Account.get(account_id) + membership = IRC.Membership.of_account(Nola.Account.get("DRgpD4fLf8PDJMLp8Dtb")) if account && connection && Enum.member?(membership, {connection.network, chan}) do {:ok, _} = Registry.register(Nola.PubSub, "#{connection.network}:events", plugin: __MODULE__) for t <- ["messages", "triggers", "outputs", "events"] do @@ -47,7 +47,7 @@ defmodule NolaWeb.ChatLive do end def handle_event("send", %{"message" => %{"text" => text}}, socket) do - account = IRC.Account.get(socket.assigns.account_id) + account = Nola.Account.get(socket.assigns.account_id) IRC.send_message_as(account, socket.assigns.network, socket.assigns.channel, text, true) {:noreply, assign(socket, :counter, socket.assigns.counter + 1)} end |