MRF, Docs.Generator: Ensure code is loaded before checking it

This commit is contained in:
Lain Soykaf 2023-11-30 09:40:17 +04:00
parent 6a6a631c81
commit 15a8acbd6c
2 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,8 @@ def list_behaviour_implementations(behaviour) 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)

View File

@ -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 @@ def config_descriptions 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