Merge branch 'resilient-user-view' into 'develop'
Make TwAPI UserView more resilient to issues. See merge request pleroma/pleroma!634
This commit is contained in:
commit
74e1093732
3 changed files with 52 additions and 1 deletions
|
|
@ -94,11 +94,25 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
|||
ap_id == "https://www.w3.org/ns/activitystreams#Public" ->
|
||||
nil
|
||||
|
||||
user = User.get_cached_by_ap_id(ap_id) ->
|
||||
user
|
||||
|
||||
user = User.get_by_guessed_nickname(ap_id) ->
|
||||
user
|
||||
|
||||
true ->
|
||||
User.get_cached_by_ap_id(ap_id)
|
||||
error_user()
|
||||
end
|
||||
end
|
||||
|
||||
defp error_user do
|
||||
%User{
|
||||
info: %User.Info{},
|
||||
nickname: "erroruser@example.com",
|
||||
inserted_at: NaiveDateTime.utc_now()
|
||||
}
|
||||
end
|
||||
|
||||
def render("index.json", opts) do
|
||||
context_ids = collect_context_ids(opts.activities)
|
||||
users = collect_users(opts.activities)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue