User.get_domain/1 --> User.get_host/1

This commit is contained in:
Alex Gleason 2020-07-29 13:06:03 -05:00
parent ffa17fa383
commit f807eb1e94
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 4 additions and 4 deletions

View File

@ -2294,7 +2294,7 @@ defmodule Pleroma.User do
|> Map.put(:fields, fields) |> Map.put(:fields, fields)
end end
def get_domain(%User{ap_id: ap_id} = _user) do def get_host(%User{ap_id: ap_id} = _user) do
URI.parse(ap_id).host URI.parse(ap_id).host
end end
end end

View File

@ -13,7 +13,7 @@
<div class="account-header__avatar" style="background-image: url('<%= Pleroma.User.avatar_url(@user) %>')"></div> <div class="account-header__avatar" style="background-image: url('<%= Pleroma.User.avatar_url(@user) %>')"></div>
<div class="account-header__meta"> <div class="account-header__meta">
<div class="account-header__display-name"><%= @user.name %></div> <div class="account-header__display-name"><%= @user.name %></div>
<div class="account-header__nickname">@<%= @user.nickname %>@<%= Pleroma.User.get_domain(@user) %></div> <div class="account-header__nickname">@<%= @user.nickname %>@<%= Pleroma.User.get_host(@user) %></div>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@ -1886,8 +1886,8 @@ defmodule Pleroma.UserTest do
assert User.avatar_url(user, no_default: true) == nil assert User.avatar_url(user, no_default: true) == nil
end end
test "get_domain/1" do test "get_host/1" do
user = insert(:user, ap_id: "https://lain.com/users/lain", nickname: "lain") user = insert(:user, ap_id: "https://lain.com/users/lain", nickname: "lain")
assert User.get_domain(user) == "lain.com" assert User.get_host(user) == "lain.com"
end end
end end