Returm generation of URL by usage of MobilizonWeb.Endpoint
This commit is contained in:
parent
da97c29340
commit
8f580ce10c
|
@ -8,9 +8,11 @@ defmodule Mobilizon.Events.Comment do
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Config
|
|
||||||
alias Mobilizon.Events.{Comment, CommentVisibility, Event}
|
alias Mobilizon.Events.{Comment, CommentVisibility, Event}
|
||||||
|
|
||||||
|
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||||
|
alias MobilizonWeb.Endpoint
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
text: String.t(),
|
text: String.t(),
|
||||||
url: String.t(),
|
url: String.t(),
|
||||||
|
@ -66,5 +68,5 @@ defmodule Mobilizon.Events.Comment do
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec generate_url(String.t()) :: String.t()
|
@spec generate_url(String.t()) :: String.t()
|
||||||
defp generate_url(uuid), do: "#{Config.instance_hostname()}/comments/#{uuid}"
|
defp generate_url(uuid), do: Routes.page_url(Endpoint, :comment, uuid)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,10 +8,11 @@ defmodule Mobilizon.Events.Participant do
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Config
|
|
||||||
alias Mobilizon.Events
|
alias Mobilizon.Events
|
||||||
alias Mobilizon.Events.{Event, ParticipantRole}
|
alias Mobilizon.Events.{Event, ParticipantRole}
|
||||||
|
|
||||||
|
alias MobilizonWeb.Endpoint
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
role: ParticipantRole.t(),
|
role: ParticipantRole.t(),
|
||||||
url: String.t(),
|
url: String.t(),
|
||||||
|
@ -82,5 +83,5 @@ defmodule Mobilizon.Events.Participant do
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec generate_url(String.t()) :: String.t()
|
@spec generate_url(String.t()) :: String.t()
|
||||||
defp generate_url(uuid), do: "#{Config.instance_hostname()}/join/event/#{uuid}"
|
defp generate_url(uuid), do: "#{Endpoint.url()}/join/event/#{uuid}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue