From f388033b75789d25a833d29a2759c0a741a61c51 Mon Sep 17 00:00:00 2001 From: Jordan Bracco Date: Tue, 20 Dec 2022 02:52:54 +0000 Subject: Rename IRC.Membership to Nola.Membership, refs T77 --- lib/web/context_plug.ex | 2 +- lib/web/controllers/alcoolog_controller.ex | 16 ++++++++-------- lib/web/controllers/irc_controller.ex | 2 +- lib/web/controllers/page_controller.ex | 2 +- lib/web/live/chat_live.ex | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/web') diff --git a/lib/web/context_plug.ex b/lib/web/context_plug.ex index 7289763..fcdf42f 100644 --- a/lib/web/context_plug.ex +++ b/lib/web/context_plug.ex @@ -36,7 +36,7 @@ defmodule NolaWeb.ContextPlug do chan_conn = IRC.Connection.get_network(network, chan) memberships = if account do - IRC.Membership.of_account(account) + Nola.Membership.of_account(account) end auth_required = cond do diff --git a/lib/web/controllers/alcoolog_controller.ex b/lib/web/controllers/alcoolog_controller.ex index dc09517..6337da5 100644 --- a/lib/web/controllers/alcoolog_controller.ex +++ b/lib/web/controllers/alcoolog_controller.ex @@ -19,7 +19,7 @@ defmodule NolaWeb.AlcoologController do def nick(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do 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) + friend? = Enum.member?(Nola.Membership.friends(account), profile_account.id) if friend? do stats = Nola.Plugins.Alcoolog.get_full_statistics(profile_account.id) history = for {{nick, ts}, points, active, cl, deg, type, descr, meta} <- Nola.Plugins.Alcoolog.nick_history(profile_account) do @@ -48,7 +48,7 @@ defmodule NolaWeb.AlcoologController do def nick_stats_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do profile_account = Nola.Account.find_always_by_nick(network, nick, nick) - friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) + friend? = Enum.member?(Nola.Membership.friends(account), profile_account.id) if friend? do stats = Nola.Plugins.Alcoolog.get_full_statistics(profile_account.id) @@ -64,7 +64,7 @@ defmodule NolaWeb.AlcoologController do def nick_gls_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do profile_account = Nola.Account.find_always_by_nick(network, nick, nick) - friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) + friend? = Enum.member?(Nola.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do data = Nola.Plugins.Alcoolog.user_over_time_gl(profile_account, count) @@ -98,7 +98,7 @@ defmodule NolaWeb.AlcoologController do def nick_volumes_json(conn = %{assigns: %{account: account}}, params = %{"network" => network, "nick" => nick}) do profile_account = Nola.Account.find_always_by_nick(network, nick, nick) - friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) + friend? = Enum.member?(Nola.Membership.friends(account), profile_account.id) count = String.to_integer(Map.get(params, "days", "180")) if friend? do data = Nola.Plugins.Alcoolog.user_over_time(profile_account, count) @@ -130,7 +130,7 @@ defmodule NolaWeb.AlcoologController do def nick_log_json(conn = %{assigns: %{account: account}}, %{"network" => network, "nick" => nick}) do profile_account = Nola.Account.find_always_by_nick(network, nick, nick) - friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) + friend? = Enum.member?(Nola.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 %{ @@ -161,7 +161,7 @@ defmodule NolaWeb.AlcoologController do def nick_history_json(conn = %{assigns: %{account: account}}, %{"network" => network, "nick" => nick}) do profile_account = Nola.Account.find_always_by_nick(network, nick, nick) - friend? = Enum.member?(IRC.Membership.friends(account), profile_account.id) + friend? = Enum.member?(Nola.Membership.friends(account), profile_account.id) if friend? do history = for {_, date, value} <- Nola.Plugs.AlcoologAnnouncer.log(profile_account) do %{date: DateTime.to_iso8601(date), value: value} @@ -220,7 +220,7 @@ defmodule NolaWeb.AlcoologController do ] # tuple ets: {{nick, date}, volumes, current, nom, commentaire} - members = IRC.Membership.expanded_members_or_friends(account, network, channel) + members = Nola.Membership.expanded_members_or_friends(account, network, channel) members_ids = Enum.map(members, fn({account, _, nick}) -> account.id end) member_names = Enum.reduce(members, %{}, fn({account, _, nick}, acc) -> Map.put(acc, account.id, nick) end) drinks = :ets.select(Nola.Plugins.Alcoolog.ETS, match) @@ -246,7 +246,7 @@ defmodule NolaWeb.AlcoologController do def index_gls_json(conn = %{assigns: %{account: account}}, %{"network" => network, "chan" => channel}) do count = 30 channel = NolaWeb.reformat_chan(channel) - members = IRC.Membership.expanded_members_or_friends(account, network, channel) + members = Nola.Membership.expanded_members_or_friends(account, network, channel) members_ids = Enum.map(members, fn({account, _, nick}) -> account.id end) member_names = Enum.reduce(members, %{}, fn({account, _, nick}, acc) -> Map.put(acc, account.id, nick) end) delay = count*((24 * 60)*60) diff --git a/lib/web/controllers/irc_controller.ex b/lib/web/controllers/irc_controller.ex index d6114e6..441cbe7 100644 --- a/lib/web/controllers/irc_controller.ex +++ b/lib/web/controllers/irc_controller.ex @@ -17,7 +17,7 @@ defmodule NolaWeb.IrcController do members = cond do network && channel -> Enum.map(IRC.UserTrack.channel(network, channel), fn(tuple) -> IRC.UserTrack.User.from_tuple(tuple) end) true -> - IRC.Membership.of_account(conn.assigns.account) + Nola.Membership.of_account(conn.assigns.account) end render conn, "index.html", network: network, commands: commands, channel: channel, members: members end diff --git a/lib/web/controllers/page_controller.ex b/lib/web/controllers/page_controller.ex index c5d0a57..a6b85b6 100644 --- a/lib/web/controllers/page_controller.ex +++ b/lib/web/controllers/page_controller.ex @@ -23,7 +23,7 @@ defmodule NolaWeb.PageController do end def index(conn = %{assigns: %{account: account}}, _) do - memberships = IRC.Membership.of_account(account) + memberships = Nola.Membership.of_account(account) users = IRC.UserTrack.find_by_account(account) metas = Nola.Account.get_all_meta(account) predicates = Nola.Account.get_predicates(account) diff --git a/lib/web/live/chat_live.ex b/lib/web/live/chat_live.ex index 0513cc2..2d5e289 100644 --- a/lib/web/live/chat_live.ex +++ b/lib/web/live/chat_live.ex @@ -7,7 +7,7 @@ defmodule NolaWeb.ChatLive do chan = NolaWeb.reformat_chan(chan) connection = IRC.Connection.get_network(network, chan) account = Nola.Account.get(account_id) - membership = IRC.Membership.of_account(Nola.Account.get("DRgpD4fLf8PDJMLp8Dtb")) + membership = Nola.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 -- cgit v1.2.3