logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 44a650235bcb49900a84f50b2ee4d75593231c38
parent: cda01285f4f36ffaac0034d6f0a5da64b4a26a58
Author: Roger Braun <roger@rogerbraun.net>
Date:   Tue, 12 Sep 2017 09:34:39 +0200

MastoAPI: Remove domain ending from account name.

Diffstat:

Mlib/pleroma/web/mastodon_api/views/account_view.ex4++--
Mtest/web/mastodon_api/account_view_test.exs4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do %{ id: user.id, - username: user.nickname, + username: hd(String.split(user.nickname, "@")), acct: user.nickname, display_name: user.name, locked: false, @@ -34,7 +34,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do %{ id: user.id, acct: user.nickname, - username: user.nickname, + username: hd(String.split(user.nickname, "@")), url: user.ap_id } end diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs @@ -4,11 +4,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do alias Pleroma.Web.MastodonAPI.AccountView 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 = %{ id: user.id, - username: user.nickname, + username: "shp", acct: user.nickname, display_name: user.name, locked: false,