Add cached RSS feeds for actors endpoints
This commit is contained in:
@@ -354,6 +354,9 @@ defmodule Mobilizon.Actors.Actor do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Return the preferred_username with the eventual @domain suffix if it's a distant actor
|
||||
"""
|
||||
@spec actor_acct_from_actor(struct()) :: String.t()
|
||||
def actor_acct_from_actor(%Actor{preferred_username: preferred_username, domain: domain}) do
|
||||
if is_nil(domain) do
|
||||
@@ -362,4 +365,16 @@ defmodule Mobilizon.Actors.Actor do
|
||||
"#{preferred_username}@#{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the display name if available, or the preferred_username (with the eventual @domain suffix if it's a distant actor).
|
||||
"""
|
||||
@spec display_name(struct()) :: String.t()
|
||||
def display_name(%Actor{name: name} = actor) do
|
||||
case name do
|
||||
nil -> actor_acct_from_actor(actor)
|
||||
"" -> actor_acct_from_actor(actor)
|
||||
name -> name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user