MastoAPI: Remove domain ending from account name.

This commit is contained in:
Roger Braun 2017-09-12 09:34:39 +02:00
parent cda01285f4
commit 44a650235b
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ def render("account.json", %{user: user}) do
%{ %{
id: user.id, id: user.id,
username: user.nickname, username: hd(String.split(user.nickname, "@")),
acct: user.nickname, acct: user.nickname,
display_name: user.name, display_name: user.name,
locked: false, locked: false,
@ -34,7 +34,7 @@ def render("mention.json", %{user: user}) do
%{ %{
id: user.id, id: user.id,
acct: user.nickname, acct: user.nickname,
username: user.nickname, username: hd(String.split(user.nickname, "@")),
url: user.ap_id url: user.ap_id
} }
end end

View File

@ -4,11 +4,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.AccountView
test "Represent a user account" do test "Represent a user account" do
user = insert(:user, %{info: %{"note_count" => 5, "follower_count" => 3}}) user = insert(:user, %{info: %{"note_count" => 5, "follower_count" => 3}, nickname: "shp@shitposter.club"})
expected = %{ expected = %{
id: user.id, id: user.id,
username: user.nickname, username: "shp",
acct: user.nickname, acct: user.nickname,
display_name: user.name, display_name: user.name,
locked: false, locked: false,