Fix failing tests
This commit is contained in:
parent
18a4cbb244
commit
2bbec33c71
5 changed files with 22 additions and 14 deletions
|
|
@ -108,17 +108,20 @@ defmodule Pleroma.Activity do
|
|||
%{
|
||||
id: data["id"],
|
||||
context: data["context"],
|
||||
type: "tombstone",
|
||||
type: "Tombstone",
|
||||
published: data["published"],
|
||||
deleted: deleted
|
||||
}
|
||||
end
|
||||
|
||||
def swap_data_with_tombstone(activity) do
|
||||
tombstone = get_tombstone(activity)
|
||||
|
||||
activity
|
||||
|> change(%{data: tombstone})
|
||||
|> Repo.update()
|
||||
with tombstone = get_tombstone(activity),
|
||||
Notification.clear(activity),
|
||||
{:ok, changed_activity} =
|
||||
activity
|
||||
|> change(%{data: tombstone})
|
||||
|> Repo.update() do
|
||||
{:ok, changed_activity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -75,10 +75,14 @@ defmodule Pleroma.Notification do
|
|||
end
|
||||
end
|
||||
|
||||
def clear(user) do
|
||||
query = from(n in Notification, where: n.user_id == ^user.id)
|
||||
def clear(%User{} = user) do
|
||||
from(n in Notification, where: n.user_id == ^user.id)
|
||||
|> Repo.delete_all()
|
||||
end
|
||||
|
||||
Repo.delete_all(query)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -586,7 +586,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
|
||||
def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) do
|
||||
with false <- String.starts_with?(inReplyTo, "http"),
|
||||
with false <- is_nil(inReplyTo),
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue