diff options
author | lain <lain@soykaf.club> | 2020-09-17 11:56:30 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-09-17 11:56:30 +0000 |
commit | 5426eb59976044f88247486da86a91b8f9eb35b5 (patch) | |
tree | c3356281c7f21a8f6e41230e01b2d413a7f5903c /lib/pleroma/web/common_api/common_api.ex | |
parent | c5acbf8a1bd1a14ea82610cb3f69b8ebbb3ea28b (diff) | |
parent | 5e3c70afa5c02926a5578628431487e92b2175e9 (diff) | |
download | pleroma-5426eb59976044f88247486da86a91b8f9eb35b5.tar.gz |
Merge branch 'chat-moderation' into 'develop'
Chat moderation MVP
See merge request pleroma/pleroma!2937
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 500c3883e..a8c83bc8f 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -550,4 +550,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 |