API: render name instead of first_name and last_name in user data
This commit is contained in:
parent
c348a763cf
commit
9e18b19d6a
3 changed files with 4 additions and 8 deletions
|
|
@ -55,8 +55,7 @@ class ProfilePresenter < BasePresenter
|
|||
|
||||
def base_api_json
|
||||
{
|
||||
first_name: first_name,
|
||||
last_name: last_name,
|
||||
name: [first_name, last_name].join(" ").presence,
|
||||
diaspora_id: diaspora_handle,
|
||||
avatar: AvatarPresenter.new(@presentable).base_hash,
|
||||
tags: tags.pluck(:name)
|
||||
|
|
|
|||
|
|
@ -229,8 +229,7 @@ describe Api::V1::UsersController do
|
|||
expect(user["birthday"]).to eq(new_birthday.iso8601)
|
||||
expect(user["location"]).to eq(new_location)
|
||||
expect(user["gender"]).to eq(new_gender)
|
||||
expect(user["first_name"]).to eq(new_first_name)
|
||||
expect(user["last_name"]).to eq(new_last_name)
|
||||
expect(user["name"]).to eq("#{new_first_name} #{new_last_name}")
|
||||
expect(user["searchable"]).to eq(new_searchable)
|
||||
expect(user["show_profile_info"]).to eq(new_show_profile_info)
|
||||
expect(user["nsfw"]).to eq(new_nsfw)
|
||||
|
|
@ -547,8 +546,7 @@ describe Api::V1::UsersController do
|
|||
def confirm_common_profile_elements(json)
|
||||
expect(json).to have_key("guid")
|
||||
expect(json).to have_key("diaspora_id")
|
||||
expect(json).to have_key("first_name")
|
||||
expect(json).to have_key("last_name")
|
||||
expect(json).to have_key("name")
|
||||
expect(json).to have_key("avatar")
|
||||
expect(json).to have_key("tags")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -214,8 +214,7 @@ describe PersonPresenter do
|
|||
def confirm_common_profile_elements(profile_hash)
|
||||
expect(profile_hash).to have_key(:guid)
|
||||
expect(profile_hash).to have_key(:diaspora_id)
|
||||
expect(profile_hash).to have_key(:first_name)
|
||||
expect(profile_hash).to have_key(:last_name)
|
||||
expect(profile_hash).to have_key(:name)
|
||||
expect(profile_hash).to have_key(:avatar)
|
||||
expect(profile_hash).to have_key(:tags)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue