Merge branch 'feature/2071-actor-type' into 'develop'

Adding actor type in user show

Closes #2071

See merge request pleroma/pleroma!2910
This commit is contained in:
lain 2020-08-21 08:36:56 +00:00
commit 02db6c596e
2 changed files with 50 additions and 25 deletions

View File

@ -79,7 +79,8 @@ def render("show.json", %{user: user}) do
"confirmation_pending" => user.confirmation_pending, "confirmation_pending" => user.confirmation_pending,
"approval_pending" => user.approval_pending, "approval_pending" => user.approval_pending,
"url" => user.uri || user.ap_id, "url" => user.uri || user.ap_id,
"registration_reason" => user.registration_reason "registration_reason" => user.registration_reason,
"actor_type" => user.actor_type
} }
end end

View File

@ -381,7 +381,8 @@ test "Show", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
assert expected == json_response(conn, 200) assert expected == json_response(conn, 200)
@ -663,7 +664,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => admin.ap_id, "url" => admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => user.deactivated, "deactivated" => user.deactivated,
@ -677,7 +679,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => user2.deactivated, "deactivated" => user2.deactivated,
@ -691,7 +694,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => true, "approval_pending" => true,
"url" => user2.ap_id, "url" => user2.ap_id,
"registration_reason" => "I'm a chill dude" "registration_reason" => "I'm a chill dude",
"actor_type" => "Person"
} }
] ]
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -766,7 +770,8 @@ test "regular search", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -794,7 +799,8 @@ test "search by domain", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -822,7 +828,8 @@ test "search by full nickname", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -850,7 +857,8 @@ test "search by display name", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -878,7 +886,8 @@ test "search by email", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -906,7 +915,8 @@ test "regular search with page size", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -929,7 +939,8 @@ test "regular search with page size", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user2.ap_id, "url" => user2.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -964,7 +975,8 @@ test "only local users" do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -992,7 +1004,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => admin.deactivated, "deactivated" => admin.deactivated,
@ -1006,7 +1019,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => admin.ap_id, "url" => admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => false, "deactivated" => false,
@ -1020,7 +1034,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => old_admin.ap_id, "url" => old_admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -1058,7 +1073,8 @@ test "only unapproved users", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => true, "approval_pending" => true,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => "Plz let me in!" "registration_reason" => "Plz let me in!",
"actor_type" => "Person"
} }
] ]
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -1091,7 +1107,8 @@ test "load only admins", %{conn: conn, admin: admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => admin.ap_id, "url" => admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => false, "deactivated" => false,
@ -1105,7 +1122,8 @@ test "load only admins", %{conn: conn, admin: admin} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => second_admin.ap_id, "url" => second_admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -1140,7 +1158,8 @@ test "load only moderators", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => moderator.ap_id, "url" => moderator.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -1168,7 +1187,8 @@ test "load users with tags list", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user1.ap_id, "url" => user1.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
}, },
%{ %{
"deactivated" => false, "deactivated" => false,
@ -1182,7 +1202,8 @@ test "load users with tags list", %{conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user2.ap_id, "url" => user2.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
|> Enum.sort_by(& &1["nickname"]) |> Enum.sort_by(& &1["nickname"])
@ -1245,7 +1266,8 @@ test "it works with multiple filters" do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -1272,7 +1294,8 @@ test "it omits relay user", %{admin: admin, conn: conn} do
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => admin.ap_id, "url" => admin.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
] ]
} }
@ -1357,7 +1380,8 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admi
"confirmation_pending" => false, "confirmation_pending" => false,
"approval_pending" => false, "approval_pending" => false,
"url" => user.ap_id, "url" => user.ap_id,
"registration_reason" => nil "registration_reason" => nil,
"actor_type" => "Person"
} }
log_entry = Repo.one(ModerationLog) log_entry = Repo.one(ModerationLog)