forked from AkkomaGang/akkoma
Streamer: fix crash in MastodonAPI.StatusView
This commit is contained in:
parent
dc63aaf84f
commit
b7bbf42acd
1 changed files with 11 additions and 3 deletions
|
@ -65,10 +65,18 @@ defp get_context_id(%{data: %{"context" => context}}) when is_binary(context),
|
||||||
|
|
||||||
defp get_context_id(_), do: nil
|
defp get_context_id(_), do: nil
|
||||||
|
|
||||||
defp reblogged?(activity, user) do
|
# Check if the user reblogged this status
|
||||||
object = Object.normalize(activity, fetch: false) || %{}
|
defp reblogged?(activity, %User{ap_id: ap_id}) do
|
||||||
present?(user && user.ap_id in (object.data["announcements"] || []))
|
with %Object{data: %{"announcements" => announcements}} when is_list(announcements) <-
|
||||||
|
Object.normalize(activity, fetch: false) do
|
||||||
|
ap_id in announcements
|
||||||
|
else
|
||||||
|
_ -> false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# False if the user is logged out
|
||||||
|
defp reblogged?(_activity, _user), do: false
|
||||||
|
|
||||||
def render("index.json", opts) do
|
def render("index.json", opts) do
|
||||||
reading_user = opts[:for]
|
reading_user = opts[:for]
|
||||||
|
|
Loading…
Reference in a new issue