Fix ModerationLog FunctionClauseError for unknown actions

Add catchall clause to handle log entries with unknown actions or
malformed data. Prevents HTTP 500 errors in admin moderation log view.

Fixes #3385
This commit is contained in:
Lain Soykaf 2025-07-21 16:36:52 +04:00 committed by Mark Felder
commit bde52824d3
2 changed files with 39 additions and 0 deletions

View file

@ -575,6 +575,12 @@ defmodule Pleroma.ModerationLog do
"@#{actor_nickname} requested account backup for @#{user_nickname}"
end
def get_log_entry_message(%ModerationLog{data: data}) do
actor_name = get_in(data, ["actor", "nickname"]) || "unknown"
action = data["action"] || "unknown"
"@#{actor_name} performed action #{action}"
end
defp nicknames_to_string(nicknames) do
nicknames
|> Enum.map(&"@#{&1}")