diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2020-09-20 19:27:27 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2020-09-20 19:27:27 +0300 |
commit | 4987ee6256c4227793240c74043845a661e3d37b (patch) | |
tree | 40abf0e0c85df9788b59f24ed4026ae00a89e5e5 /lib/pleroma/web/common_api/common_api.ex | |
parent | 44e8b6037ae71881327451dcf7d9351f1ba82674 (diff) | |
parent | 882c1fc6bdff4e27955730a412d73ead0e67a741 (diff) | |
download | pleroma-4987ee6256c4227793240c74043845a661e3d37b.tar.gz |
Merge branch 'develop' into feature/expire-mutes
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index b49a95791..fca9246a5 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -48,6 +48,9 @@ defmodule Pleroma.Web.CommonAPI do local: true )} do {:ok, activity} + else + {:common_pipeline, {:reject, _} = e} -> e + e -> e end end @@ -560,4 +563,21 @@ defmodule Pleroma.Web.CommonAPI do def show_reblogs(%User{} = user, %User{} = target) do UserRelationship.delete_reblog_mute(user, target) end + + def get_user(ap_id, fake_record_fallback \\ true) do + cond do + user = User.get_cached_by_ap_id(ap_id) -> + user + + user = User.get_by_guessed_nickname(ap_id) -> + user + + fake_record_fallback -> + # TODO: refactor (fake records is never a good idea) + User.error_user(ap_id) + + true -> + nil + end + end end |