end
end
- def clear(%User{} = user) do
+ def clear(user) do
from(n in Notification, where: n.user_id == ^user.id)
|> Repo.delete_all()
end
- def clear(%Activity{} = activity) do
- from(n in Notification, where: n.activity_id == ^activity.id)
- |> Repo.delete_all()
- end
-
def dismiss(%{id: user_id} = _user, id) do
notification = Repo.get(Notification, id)
end
def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) do
- with false <- is_nil(inReplyTo),
- false <- String.starts_with?(inReplyTo, "http"),
+ with false <- String.starts_with?(inReplyTo, "http"),
{:ok, %{data: replied_to_object}} <- get_obj_helper(inReplyTo) do
Map.put(object, "inReplyTo", replied_to_object["external_url"] || inReplyTo)
else
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
if inReplyTo do
- to =
- [inReplyTo.data["actor"] | mentioned_users]
- |> Enum.uniq()
- |> Enum.reject(&is_nil/1)
-
- {to, []}
+ {Enum.uniq([inReplyTo.data["actor"] | mentioned_users]), []}
else
{mentioned_users, []}
end