X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Faccount_view_test.exs;h=9fe9d73bc7556e42b2b2c58865f76fa383e4f978;hb=40414bf177c93b39d75c6091ef0ce1db093edb6f;hp=5373a17c38f84a0db34a20ef213e0812daadd7b3;hpb=008499f65a33f5d42a98cc3719f6ab5e8def40d6;p=akkoma diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 5373a17c3..9fe9d73bc 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -271,7 +271,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do requested: false, domain_blocking: false, showing_reblogs: true, - endorsed: false + endorsed: false, + note: "" } test "represent a relationship for the following and followed user" do @@ -468,6 +469,23 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do %{user: user, for: user} )[:pleroma][:unread_notifications_count] == 7 end + + test "shows email only to the account owner" do + user = insert(:user) + other_user = insert(:user) + + user = User.get_cached_by_ap_id(user.ap_id) + + assert AccountView.render( + "show.json", + %{user: user, for: other_user} + )[:pleroma][:email] == nil + + assert AccountView.render( + "show.json", + %{user: user, for: user} + )[:pleroma][:email] == user.email + end end describe "follow requests counter" do @@ -562,12 +580,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do AccountView.render("show.json", %{user: user, skip_visibility_check: true}) |> Enum.all?(fn {key, url} when key in [:avatar, :avatar_static, :header, :header_static] -> - String.starts_with?(url, Pleroma.Web.base_url()) + String.starts_with?(url, Pleroma.Web.Endpoint.url()) {:emojis, emojis} -> Enum.all?(emojis, fn %{url: url, static_url: static_url} -> - String.starts_with?(url, Pleroma.Web.base_url()) && - String.starts_with?(static_url, Pleroma.Web.base_url()) + String.starts_with?(url, Pleroma.Web.Endpoint.url()) && + String.starts_with?(static_url, Pleroma.Web.Endpoint.url()) end) _ ->