mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-18 10:59:17 +00:00
Merge branch 'twitter-api-null-display-name' into 'develop'
Twitter API: Fall back to user.nickname if user has no name Closes #375 See merge request pleroma/pleroma!444
This commit is contained in:
commit
0ce5623134
|
@ -55,8 +55,12 @@ def render("user.json", %{user: user = %User{}} = assigns) do
|
|||
"statusnet_blocking" => statusnet_blocking,
|
||||
"friends_count" => user_info[:following_count],
|
||||
"id" => user.id,
|
||||
"name" => user.name,
|
||||
"name_html" => HTML.strip_tags(user.name) |> Formatter.emojify(emoji),
|
||||
"name" => user.name || user.nickname,
|
||||
"name_html" =>
|
||||
if(user.name,
|
||||
do: HTML.strip_tags(user.name) |> Formatter.emojify(emoji),
|
||||
else: user.nickname
|
||||
),
|
||||
"profile_image_url" => image,
|
||||
"profile_image_url_https" => image,
|
||||
"profile_image_url_profile_size" => image,
|
||||
|
|
|
@ -13,6 +13,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
[user: user]
|
||||
end
|
||||
|
||||
test "A user with only a nickname", %{user: user} do
|
||||
user = %{user | name: nil, nickname: "scarlett@catgirl.science"}
|
||||
represented = UserView.render("show.json", %{user: user})
|
||||
assert represented["name"] == user.nickname
|
||||
assert represented["name_html"] == user.nickname
|
||||
end
|
||||
|
||||
test "A user with an avatar object", %{user: user} do
|
||||
image = "image"
|
||||
user = %{user | avatar: %{"url" => [%{"href" => image}]}}
|
||||
|
|
Loading…
Reference in a new issue