Merge branch 'add-url-to-admin-account-view' into 'develop'

Add `url` field to AdminAPI.AccountView

See merge request pleroma/pleroma!2633
This commit is contained in:
lain 2020-06-09 12:59:14 +00:00
commit 1b746cfbbb
2 changed files with 46 additions and 23 deletions

View File

@ -76,7 +76,8 @@ def render("show.json", %{user: user}) do
"local" => user.local,
"roles" => User.roles(user),
"tags" => user.tags || [],
"confirmation_pending" => user.confirmation_pending
"confirmation_pending" => user.confirmation_pending,
"url" => user.uri || user.ap_id
}
end

View File

@ -337,7 +337,8 @@ test "Show", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
assert expected == json_response(conn, 200)
@ -614,7 +615,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
"tags" => [],
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => admin.ap_id
},
%{
"deactivated" => user.deactivated,
@ -625,7 +627,8 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do
"tags" => ["foo", "bar"],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
|> Enum.sort_by(& &1["nickname"])
@ -697,7 +700,8 @@ test "regular search", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -722,7 +726,8 @@ test "search by domain", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -747,7 +752,8 @@ test "search by full nickname", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -772,7 +778,8 @@ test "search by display name", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -797,7 +804,8 @@ test "search by email", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -822,7 +830,8 @@ test "regular search with page size", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -842,7 +851,8 @@ test "regular search with page size", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(user2) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user2.name || user2.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user2.ap_id
}
]
}
@ -874,7 +884,8 @@ test "only local users" do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -899,7 +910,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
},
%{
"deactivated" => admin.deactivated,
@ -910,7 +922,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"tags" => [],
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => admin.ap_id
},
%{
"deactivated" => false,
@ -921,7 +934,8 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
"tags" => [],
"avatar" => User.avatar_url(old_admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(old_admin.name || old_admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => old_admin.ap_id
}
]
|> Enum.sort_by(& &1["nickname"])
@ -951,7 +965,8 @@ test "load only admins", %{conn: conn, admin: admin} do
"tags" => [],
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => admin.ap_id
},
%{
"deactivated" => false,
@ -962,7 +977,8 @@ test "load only admins", %{conn: conn, admin: admin} do
"tags" => [],
"avatar" => User.avatar_url(second_admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(second_admin.name || second_admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => second_admin.ap_id
}
]
|> Enum.sort_by(& &1["nickname"])
@ -994,7 +1010,8 @@ test "load only moderators", %{conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(moderator) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(moderator.name || moderator.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => moderator.ap_id
}
]
}
@ -1019,7 +1036,8 @@ test "load users with tags list", %{conn: conn} do
"tags" => ["first"],
"avatar" => User.avatar_url(user1) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user1.name || user1.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user1.ap_id
},
%{
"deactivated" => false,
@ -1030,7 +1048,8 @@ test "load users with tags list", %{conn: conn} do
"tags" => ["second"],
"avatar" => User.avatar_url(user2) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user2.name || user2.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user2.ap_id
}
]
|> Enum.sort_by(& &1["nickname"])
@ -1069,7 +1088,8 @@ test "it works with multiple filters" do
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
]
}
@ -1093,7 +1113,8 @@ test "it omits relay user", %{admin: admin, conn: conn} do
"tags" => [],
"avatar" => User.avatar_url(admin) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(admin.name || admin.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => admin.ap_id
}
]
}
@ -1155,7 +1176,8 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admi
"tags" => [],
"avatar" => User.avatar_url(user) |> MediaProxy.url(),
"display_name" => HTML.strip_tags(user.name || user.nickname),
"confirmation_pending" => false
"confirmation_pending" => false,
"url" => user.ap_id
}
log_entry = Repo.one(ModerationLog)