don't persist undo of follows #149

Merged
floatingghost merged 5 commits from follow-undo-persistance into develop 2022-08-05 13:28:56 +00:00
Showing only changes of commit e53a3a99e7 - Show all commits

View file

@ -347,11 +347,11 @@ defp do_unfollow(follower, followed, activity_id, false) do
# On a remote unfollow, _remove_ their activity from the database, since some software (MISSKEEEEY) # On a remote unfollow, _remove_ their activity from the database, since some software (MISSKEEEEY)
# uses deterministic ids for follows. # uses deterministic ids for follows.
with %Activity{} = follow_activity <- fetch_latest_follow(follower, followed), with %Activity{} = follow_activity <- fetch_latest_follow(follower, followed),
{:ok, activity} <- Repo.delete(follow_activity), {:ok, _activity} <- Repo.delete(follow_activity),
unfollow_data <- make_unfollow_data(follower, followed, follow_activity, activity_id), unfollow_data <- make_unfollow_data(follower, followed, follow_activity, activity_id),
unfollow_activity <- remote_unfollow_data(unfollow_data), unfollow_activity <- remote_unfollow_data(unfollow_data),
_ <- notify_and_stream(unfollow_activity) do _ <- notify_and_stream(unfollow_activity) do
{:ok, activity} {:ok, unfollow_activity}
else else
nil -> nil nil -> nil
{:error, error} -> Repo.rollback(error) {:error, error} -> Repo.rollback(error)