From 056305dfa745f679ce0082c08abb06725432dc5d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 19 Jun 2018 08:31:06 +0000 Subject: [PATCH] user: add helper function to fetch a user given only an ap_id (fix tests) --- lib/pleroma/user.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index bfa5d78a4..aba8742a0 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -527,6 +527,11 @@ defmodule Pleroma.User do update_and_set_cache(cs) end + # helper to handle the block given only an actor's AP id + def block(blocker, %{ap_id: ap_id}) do + block(blocker, User.get_by_ap_id(ap_id)) + end + def unblock(user, %{ap_id: ap_id}) do blocks = user.info["blocks"] || [] new_blocks = List.delete(blocks, ap_id) -- 2.45.2