projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SideEffects: Ensure a chat is present before streaming something out.
[akkoma]
/
lib
/
pleroma
/
web
/
web.ex
diff --git
a/lib/pleroma/web/web.ex
b/lib/pleroma/web/web.ex
index 08e42a7e5398737cd14f1f8b9e7c80b1f8c60834..4f9281851dd5d43a2f3812d49cd89a7a509ef320 100644
(file)
--- a/
lib/pleroma/web/web.ex
+++ b/
lib/pleroma/web/web.ex
@@
-200,11
+200,17
@@
defmodule Pleroma.Web do
@impl Plug
@doc """
@impl Plug
@doc """
- If marked as skipped, returns `conn`, otherwise calls `perform/2`.
+ Before-plug hook that
+ * ensures the plug is not skipped
+ * processes `:if_func` / `:unless_func` functional pre-run conditions
+ * adds plug to the list of called plugs and calls `perform/2` if checks are passed
+
Note: multiple invocations of the same plug (with different or same options) are allowed.
"""
def call(%Plug.Conn{} = conn, options) do
Note: multiple invocations of the same plug (with different or same options) are allowed.
"""
def call(%Plug.Conn{} = conn, options) do
- if PlugHelper.plug_skipped?(conn, __MODULE__) do
+ if PlugHelper.plug_skipped?(conn, __MODULE__) ||
+ (options[:if_func] && !options[:if_func].(conn)) ||
+ (options[:unless_func] && options[:unless_func].(conn)) do
conn
else
conn =
conn
else
conn =