diff options
| author | Lain Soykaf <lain@lain.com> | 2023-11-30 09:40:17 +0400 | 
|---|---|---|
| committer | Lain Soykaf <lain@lain.com> | 2023-11-30 09:40:17 +0400 | 
| commit | 15a8acbd6cc6ecc89b49956acfeba49d02270c1d (patch) | |
| tree | cf555b515f08f5f27f0226a8d0177a51cc9add33 | |
| parent | 6a6a631c814ff946358dd386bd41bda2c8a37111 (diff) | |
| download | pleroma-15a8acbd6cc6ecc89b49956acfeba49d02270c1d.tar.gz pleroma-15a8acbd6cc6ecc89b49956acfeba49d02270c1d.zip  | |
MRF, Docs.Generator: Ensure code is loaded before checking it
| -rw-r--r-- | lib/pleroma/docs/generator.ex | 2 | ||||
| -rw-r--r-- | lib/pleroma/web/activity_pub/mrf.ex | 3 | 
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/pleroma/docs/generator.ex b/lib/pleroma/docs/generator.ex index 6508f1947..456a8fd54 100644 --- a/lib/pleroma/docs/generator.ex +++ b/lib/pleroma/docs/generator.ex @@ -17,6 +17,8 @@ defmodule Pleroma.Docs.Generator do        # This shouldn't be needed as all modules are expected to have module_info/1,        # but in test enviroments some transient modules `:elixir_compiler_XX`        # are loaded for some reason (where XX is a random integer). +      Code.ensure_loaded(module) +        if function_exported?(module, :module_info, 1) do          module.module_info(:attributes)          |> Keyword.get_values(:behaviour) diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index ff9f84497..a0deac300 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -54,6 +54,8 @@ defmodule Pleroma.Web.ActivityPub.MRF do    @required_description_keys [:key, :related_policy]    def filter_one(policy, message) do +    Code.ensure_loaded(policy) +      should_plug_history? =        if function_exported?(policy, :history_awareness, 0) do          policy.history_awareness() @@ -188,6 +190,7 @@ defmodule Pleroma.Web.ActivityPub.MRF do    def config_descriptions(policies) do      Enum.reduce(policies, @mrf_config_descriptions, fn policy, acc -> +      Code.ensure_loaded(policy)        if function_exported?(policy, :config_description, 0) do          description =            @default_description  | 
