summaryrefslogtreecommitdiff
path: root/lib/lsg_web/controllers/irc_controller.ex
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-02 08:27:56 +0200
committerhref <href@random.sh>2021-09-02 08:29:49 +0200
commit47c4ab1323b8ce7556f865954748cab35d27e757 (patch)
tree9cf829d133962450d7973fb71508cc500744ec76 /lib/lsg_web/controllers/irc_controller.ex
parentPhoenix 1.6rc0 & Use proper Esbuild/Tailwind/Npm (diff)
web: show help for only enabled plugins
Diffstat (limited to 'lib/lsg_web/controllers/irc_controller.ex')
-rw-r--r--lib/lsg_web/controllers/irc_controller.ex11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex
index 9ddeefc..32007c2 100644
--- a/lib/lsg_web/controllers/irc_controller.ex
+++ b/lib/lsg_web/controllers/irc_controller.ex
@@ -6,11 +6,14 @@ defmodule LSGWeb.IrcController do
def index(conn, params) do
network = Map.get(params, "network")
channel = if c = Map.get(params, "channel"), do: LSGWeb.reformat_chan(c)
- commands = for mod <- ([IRC.Account.AccountPlugin] ++ Application.get_env(:lsg, :irc)[:plugins] ++ Application.get_env(:lsg, :irc)[:handlers]) do
- identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
- {identifier, mod.irc_doc()}
+ commands = for mod <- Enum.uniq([IRC.Account.AccountPlugin] ++ IRC.Plugin.enabled()) do
+ if is_atom(mod) do
+ identifier = Module.split(mod) |> List.last |> String.replace("Plugin", "") |> Macro.underscore
+ {identifier, mod.irc_doc()}
+ end
end
- |> Enum.reject(fn({_, i}) -> i == nil end)
+ |> Enum.filter(& &1)
+ |> Enum.filter(fn({_, doc}) -> doc end)
members = cond do
network -> IRC.Membership.expanded_members_or_friends(conn.assigns.account, network, channel)
true -> IRC.Membership.of_account(conn.assigns.account)