mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 19:29:11 +00:00
Do not rembed the object after updating it
This commit is contained in:
parent
5329e84d62
commit
4f1b9c54b9
2 changed files with 2 additions and 16 deletions
|
@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Not being able to pin unlisted posts
|
- Not being able to pin unlisted posts
|
||||||
|
- Objects being re-embedded to activities after being updated (e.g faved/reposted). Running 'mix pleroma.database prune_objects' again is advised.
|
||||||
- Metadata rendering errors resulting in the entire page being inaccessible
|
- Metadata rendering errors resulting in the entire page being inaccessible
|
||||||
- Federation/MediaProxy not working with instances that have wrong certificate order
|
- Federation/MediaProxy not working with instances that have wrong certificate order
|
||||||
- Mastodon API: Handling of search timeouts (`/api/v1/search` and `/api/v2/search`)
|
- Mastodon API: Handling of search timeouts (`/api/v1/search` and `/api/v2/search`)
|
||||||
|
|
|
@ -251,20 +251,6 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
|
|
||||||
def insert_full_object(map), do: {:ok, map, nil}
|
def insert_full_object(map), do: {:ok, map, nil}
|
||||||
|
|
||||||
def update_object_in_activities(%{data: %{"id" => id}} = object) do
|
|
||||||
# TODO
|
|
||||||
# Update activities that already had this. Could be done in a seperate process.
|
|
||||||
# Alternatively, just don't do this and fetch the current object each time. Most
|
|
||||||
# could probably be taken from cache.
|
|
||||||
relevant_activities = Activity.get_all_create_by_object_ap_id(id)
|
|
||||||
|
|
||||||
Enum.map(relevant_activities, fn activity ->
|
|
||||||
new_activity_data = activity.data |> Map.put("object", object.data)
|
|
||||||
changeset = Changeset.change(activity, data: new_activity_data)
|
|
||||||
Repo.update(changeset)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
#### Like-related helpers
|
#### Like-related helpers
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -347,8 +333,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
|> Map.put("#{property}_count", length(element))
|
|> Map.put("#{property}_count", length(element))
|
||||||
|> Map.put("#{property}s", element),
|
|> Map.put("#{property}s", element),
|
||||||
changeset <- Changeset.change(object, data: new_data),
|
changeset <- Changeset.change(object, data: new_data),
|
||||||
{:ok, object} <- Object.update_and_set_cache(changeset),
|
{:ok, object} <- Object.update_and_set_cache(changeset) do
|
||||||
_ <- update_object_in_activities(object) do
|
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue