Stop adding statusnetConversationIds.
This commit is contained in:
parent
379caca01d
commit
009fcd2acf
|
@ -33,8 +33,6 @@ def create(to, actor, context, object, additional \\ %{}, published \\ nil) do
|
|||
|> Map.merge(additional)
|
||||
|
||||
with {:ok, activity} <- insert(activity) do
|
||||
{:ok, activity} = add_conversation_id(activity)
|
||||
|
||||
if actor.local do
|
||||
Pleroma.Web.Federator.enqueue(:publish, activity)
|
||||
end
|
||||
|
@ -43,24 +41,6 @@ def create(to, actor, context, object, additional \\ %{}, published \\ nil) do
|
|||
end
|
||||
end
|
||||
|
||||
defp add_conversation_id(activity) do
|
||||
if is_integer(activity.data["statusnetConversationId"]) do
|
||||
{:ok, activity}
|
||||
else
|
||||
data = activity.data
|
||||
|> put_in(["object", "statusnetConversationId"], activity.id)
|
||||
|> put_in(["statusnetConversationId"], activity.id)
|
||||
|
||||
object = Object.get_by_ap_id(activity.data["object"]["id"])
|
||||
|
||||
changeset = Ecto.Changeset.change(object, data: data["object"])
|
||||
Repo.update(changeset)
|
||||
|
||||
changeset = Ecto.Changeset.change(activity, data: data)
|
||||
Repo.update(changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def like(%User{ap_id: ap_id} = user, %Object{data: %{ "id" => id}} = object) do
|
||||
cond do
|
||||
# There's already a like here, so return the original activity.
|
||||
|
|
|
@ -41,11 +41,9 @@ test "create a status" do
|
|||
assert Enum.member?(get_in(activity.data, ["to"]), "https://www.w3.org/ns/activitystreams#Public")
|
||||
assert Enum.member?(get_in(activity.data, ["to"]), "shp")
|
||||
|
||||
# Add a context + 'statusnet_conversation_id'
|
||||
# Add a context
|
||||
assert is_binary(get_in(activity.data, ["context"]))
|
||||
assert is_binary(get_in(activity.data, ["object", "context"]))
|
||||
assert get_in(activity.data, ["object", "statusnetConversationId"]) == activity.id
|
||||
assert get_in(activity.data, ["statusnetConversationId"]) == activity.id
|
||||
|
||||
assert is_list(activity.data["object"]["attachment"])
|
||||
|
||||
|
|
Loading…
Reference in a new issue