Actually put some onformation in the error user, make it actually properly parse

in conversations.
This commit is contained in:
lain 2019-01-07 20:59:30 +01:00
parent 74e1093732
commit a16b17cc61
2 changed files with 10 additions and 5 deletions

View File

@ -101,12 +101,14 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
user user
true -> true ->
error_user() error_user(ap_id)
end end
end end
defp error_user do defp error_user(ap_id) do
%User{ %User{
name: ap_id,
ap_id: ap_id,
info: %User.Info{}, info: %User.Info{},
nickname: "erroruser@example.com", nickname: "erroruser@example.com",
inserted_at: NaiveDateTime.utc_now() inserted_at: NaiveDateTime.utc_now()

View File

@ -25,7 +25,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
import Mock import Mock
test "returns an error user for activities missing users" do test "returns a temporary ap_id based user for activities missing db users" do
user = insert(:user) user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!", "visibility" => "direct"}) {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!", "visibility" => "direct"})
@ -33,8 +33,11 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
Repo.delete(user) Repo.delete(user)
Cachex.clear(:user_cache) Cachex.clear(:user_cache)
result = ActivityView.render("activity.json", activity: activity) %{"user" => tw_user} = ActivityView.render("activity.json", activity: activity)
assert result
assert tw_user["screen_name"] == "erroruser@example.com"
assert tw_user["name"] == user.ap_id
assert tw_user["statusnet_profile_url"] == user.ap_id
end end
test "tries to get a user by nickname if fetching by ap_id doesn't work" do test "tries to get a user by nickname if fetching by ap_id doesn't work" do