Streamer: Don't crash on streaming chat notifications

This commit is contained in:
lain 2020-05-25 17:27:45 +02:00
commit dbd07d29a3
2 changed files with 20 additions and 4 deletions

View file

@ -467,12 +467,13 @@ defmodule Pleroma.Web.CommonAPI do
{:ok, activity}
end
def thread_muted?(%{id: nil} = _user, _activity), do: false
def thread_muted?(user, activity) do
ThreadMute.exists?(user.id, activity.data["context"])
def thread_muted?(%User{id: user_id}, %{data: %{"context" => context}})
when is_binary("context") do
ThreadMute.exists?(user_id, context)
end
def thread_muted?(_, _), do: false
def report(user, data) do
with {:ok, account} <- get_reported_account(data.account_id),
{:ok, {content_html, _, _}} <- make_report_content_html(data[:comment]),