refactor: use Phoenix verified routes

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-12-01 09:49:54 +01:00
parent 4f15535fa9
commit b315e1d7ff
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
83 changed files with 227 additions and 372 deletions

View File

@ -1,15 +1,15 @@
155A1FB53DE39EC8EFCFD7FB94EA823D 155A1FB53DE39EC8EFCFD7FB94EA823D
1C29EE70E90ECED01AF28EC58D2575B5 1C29EE70E90ECED01AF28EC58D2575B5
2BB1D36656B423758A470021718FCB09
31CE26BC979C57B9E3CC97B40C290CE5 31CE26BC979C57B9E3CC97B40C290CE5
3529E7A4CECC24D02678820E6F521162 3529E7A4CECC24D02678820E6F521162
37E854EA3BDF7275C6A7631F80804EC4 3644C4E850300482AA409471EFE1EFB3
4E7C044C59E0BCB76AA826789998F624 4E7C044C59E0BCB76AA826789998F624
53CBBEB6243FAF5C37249CBA17DE6F4C 53CBBEB6243FAF5C37249CBA17DE6F4C
5BCE3651A03711295046DE48BDFE007E 5BCE3651A03711295046DE48BDFE007E
5C16A2AE6A24E4795F95DDE20EEC458E
5C4CED447689F00D9D1ACEB9B895ED29 5C4CED447689F00D9D1ACEB9B895ED29
630C0972985257251EDF89A7117DE423 90EB7E986B2A3A0C3851B6BF158ECD73
94ACF7B17C3FF42F64E57DD1DA936BD8 94ACF7B17C3FF42F64E57DD1DA936BD8
A32E125003F1EDFAD95C487C6A969725 A32E125003F1EDFAD95C487C6A969725
ACF6272A1DBB3A2ABD96C0C120B5CA69 ACF6272A1DBB3A2ABD96C0C120B5CA69

View File

@ -14,7 +14,7 @@ defmodule Mobilizon.Federation.WebFinger do
alias Mobilizon.Federation.WebFinger.XmlBuilder alias Mobilizon.Federation.WebFinger.XmlBuilder
alias Mobilizon.Service.HTTP.{HostMetaClient, WebfingerClient} alias Mobilizon.Service.HTTP.{HostMetaClient, WebfingerClient}
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
require Jason require Jason
require Logger require Logger
import SweetXml import SweetXml
@ -85,7 +85,7 @@ defmodule Mobilizon.Federation.WebFinger do
%{"rel" => "self", "type" => "application/activity+json", "href" => actor.url}, %{"rel" => "self", "type" => "application/activity+json", "href" => actor.url},
%{ %{
"rel" => "http://ostatus.org/schema/1.0/subscribe", "rel" => "http://ostatus.org/schema/1.0/subscribe",
"template" => "#{Routes.page_url(Endpoint, :interact, uri: nil)}{uri}" "template" => "#{url(~p"/interact?#{[uri: nil]}")}{uri}"
} }
] ]
|> maybe_add_avatar(actor) |> maybe_add_avatar(actor)

View File

@ -9,8 +9,7 @@ defmodule Mix.Tasks.Mobilizon.Maintenance.DetectSpam do
alias Mobilizon.Service.AntiSpam alias Mobilizon.Service.AntiSpam
import Mix.Tasks.Mobilizon.Common import Mix.Tasks.Mobilizon.Common
alias Mobilizon.Federation.ActivityPub.Actions alias Mobilizon.Federation.ActivityPub.Actions
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
@shortdoc "Scan all profiles and events against spam detector and report them" @shortdoc "Scan all profiles and events against spam detector and report them"
@ -163,9 +162,7 @@ defmodule Mix.Tasks.Mobilizon.Maintenance.DetectSpam do
end end
defp handle_spam_event(event_id, event_title, event_uuid, organizer_actor_id, options) do defp handle_spam_event(event_id, event_title, event_uuid, organizer_actor_id, options) do
shell_info( shell_info("Detected event #{event_title} as spam: #{url(~p"/events/#{event_uuid}")}")
"Detected event #{event_title} as spam: #{Routes.page_url(Endpoint, :event, event_uuid)}"
)
unless dry_run?(options) do unless dry_run?(options) do
report_spam_event(event_id, event_title, organizer_actor_id, options) report_spam_event(event_id, event_title, organizer_actor_id, options)

View File

@ -19,6 +19,7 @@ defmodule Mobilizon.Actors.Actor do
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext, only: [dgettext: 2] import Mobilizon.Web.Gettext, only: [dgettext: 2]
import Mobilizon.Service.Guards, only: [is_valid_string: 1] import Mobilizon.Service.Guards, only: [is_valid_string: 1]
@ -445,7 +446,7 @@ defmodule Mobilizon.Actors.Actor do
# Relay has a special URI # Relay has a special URI
def build_url("relay", :page, _args), def build_url("relay", :page, _args),
do: Endpoint |> Routes.activity_pub_url(:relay) |> URI.decode() do: ~p"/relay" |> url() |> URI.decode()
def build_url(preferred_username, endpoint, args) def build_url(preferred_username, endpoint, args)
when endpoint in [:page, :resources, :posts, :discussions, :events, :todos] do when endpoint in [:page, :resources, :posts, :discussions, :events, :todos] do

View File

@ -15,8 +15,7 @@ defmodule Mobilizon.Discussions.Comment do
alias Mobilizon.Medias.Media alias Mobilizon.Medias.Media
alias Mobilizon.Mention alias Mobilizon.Mention
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
@type t :: %__MODULE__{ @type t :: %__MODULE__{
text: String.t(), text: String.t(),
@ -160,7 +159,7 @@ defmodule Mobilizon.Discussions.Comment do
end end
@spec generate_url(String.t()) :: String.t() @spec generate_url(String.t()) :: String.t()
defp generate_url(uuid), do: Routes.page_url(Endpoint, :comment, uuid) defp generate_url(uuid), do: url(~p"/comments/#{uuid}")
@spec put_tags(Ecto.Changeset.t(), map) :: Ecto.Changeset.t() @spec put_tags(Ecto.Changeset.t(), map) :: Ecto.Changeset.t()
defp put_tags(changeset, %{"tags" => tags}), defp put_tags(changeset, %{"tags" => tags}),

View File

@ -27,8 +27,7 @@ defmodule Mobilizon.Discussions.Discussion do
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Discussions.Comment alias Mobilizon.Discussions.Comment
alias Mobilizon.Discussions.Discussion.TitleSlug alias Mobilizon.Discussions.Discussion.TitleSlug
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 2] import Mobilizon.Web.Gettext, only: [dgettext: 2]
@type t :: %__MODULE__{ @type t :: %__MODULE__{
@ -101,5 +100,5 @@ defmodule Mobilizon.Discussions.Discussion do
@spec generate_url(String.t(), String.t()) :: String.t() @spec generate_url(String.t(), String.t()) :: String.t()
defp generate_url(preferred_username, slug), defp generate_url(preferred_username, slug),
do: Routes.page_url(Endpoint, :discussion, preferred_username, slug) do: url(~p"/@:#{preferred_username}/c/#{slug}")
end end

View File

@ -32,8 +32,7 @@ defmodule Mobilizon.Events.Event do
alias Mobilizon.Medias.Media alias Mobilizon.Medias.Media
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
@type t :: %__MODULE__{ @type t :: %__MODULE__{
id: integer(), id: integer(),
@ -140,7 +139,7 @@ defmodule Mobilizon.Events.Event do
@spec changeset(t | Ecto.Schema.t(), map) :: Changeset.t() @spec changeset(t | Ecto.Schema.t(), map) :: Changeset.t()
def changeset(%__MODULE__{} = event, attrs) do def changeset(%__MODULE__{} = event, attrs) do
attrs = Map.update(attrs, :uuid, Ecto.UUID.generate(), &(&1 || Ecto.UUID.generate())) attrs = Map.update(attrs, :uuid, Ecto.UUID.generate(), &(&1 || Ecto.UUID.generate()))
attrs = Map.update(attrs, :url, Routes.page_url(Endpoint, :event, attrs.uuid), & &1) attrs = Map.update(attrs, :url, url(~p"/events/#{attrs.uuid}"), & &1)
event event
|> cast(attrs, @attrs) |> cast(attrs, @attrs)

View File

@ -27,8 +27,7 @@ defmodule Mobilizon.Posts.Post do
alias Mobilizon.Medias.Media alias Mobilizon.Medias.Media
alias Mobilizon.Posts.Post.TitleSlug alias Mobilizon.Posts.Post.TitleSlug
alias Mobilizon.Posts.PostVisibility alias Mobilizon.Posts.PostVisibility
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext import Mobilizon.Web.Gettext
@type t :: %__MODULE__{ @type t :: %__MODULE__{
@ -128,7 +127,7 @@ defmodule Mobilizon.Posts.Post do
@spec generate_url(String.t()) :: String.t() @spec generate_url(String.t()) :: String.t()
defp generate_url(id_and_slug) when is_binary(id_and_slug), defp generate_url(id_and_slug) when is_binary(id_and_slug),
do: Routes.page_url(Endpoint, :post, id_and_slug) do: url(~p"/p/#{id_and_slug}")
defp generate_url(_), do: nil defp generate_url(_), do: nil

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Comment do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -78,11 +77,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Comment do
end end
defp event_url(activity) do defp event_url(activity) do
Routes.page_url( url(~p"/events/#{activity.subject_params["event_uuid"]}")
Endpoint,
:event,
activity.subject_params["event_uuid"]
)
end end
defp event_comment_url(activity) do defp event_comment_url(activity) do

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Conversation do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -61,11 +60,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Conversation do
end end
defp conversation_url(activity) do defp conversation_url(activity) do
Routes.page_url( url(~p"/conversations/#{activity.subject_params["conversation_id"]}")
Endpoint,
:conversation,
activity.subject_params["conversation_id"]
)
end end
defp profile(activity), do: Actor.display_name_and_username(activity.author) defp profile(activity), do: Actor.display_name_and_username(activity.author)

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Discussion do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -113,12 +112,8 @@ defmodule Mobilizon.Service.Activity.Renderer.Discussion do
end end
defp discussion_url(activity) do defp discussion_url(activity) do
Endpoint ~p"/@#{Actor.preferred_username_and_domain(activity.group)}/c/#{activity.subject_params["discussion_slug"]}"
|> Routes.page_url( |> url()
:discussion,
Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"]
)
|> URI.decode() |> URI.decode()
end end

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Event do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -81,11 +80,8 @@ defmodule Mobilizon.Service.Activity.Renderer.Event do
end end
defp event_url(activity) do defp event_url(activity) do
Endpoint ~p"/events/#{activity.subject_params["event_uuid"]}"
|> Routes.page_url( |> url()
:event,
activity.subject_params["event_uuid"]
)
|> URI.decode() |> URI.decode()
end end

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Group do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -30,8 +29,8 @@ defmodule Mobilizon.Service.Activity.Renderer.Group do
end end
defp group_url(activity) do defp group_url(activity) do
Endpoint ~p"/@#{Actor.preferred_username_and_domain(activity.group)}"
|> Routes.page_url(:actor, Actor.preferred_username_and_domain(activity.group)) |> url()
|> URI.decode() |> URI.decode()
end end

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Member do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -81,12 +80,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Member do
defp member_url(activity) do defp member_url(activity) do
group_url = group_url =
Endpoint ~p"/@#{Actor.preferred_username_and_domain(activity.group)}" |> url() |> URI.decode()
|> Routes.page_url(
:actor,
Actor.preferred_username_and_domain(activity.group)
)
|> URI.decode()
"#{group_url}/settings/members" "#{group_url}/settings/members"
end end

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Post do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -52,12 +51,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Post do
end end
defp post_url(activity) do defp post_url(activity) do
Endpoint URI.decode(~p"/p/#{activity.subject_params["post_slug"]}")
|> Routes.page_url(
:post,
activity.subject_params["post_slug"]
)
|> URI.decode()
end end
defp profile(activity), do: Actor.display_name_and_username(activity.author) defp profile(activity), do: Actor.display_name_and_username(activity.author)

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Resource do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Web.Gettext, only: [dgettext: 3] import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer @behaviour Renderer
@ -73,8 +72,8 @@ defmodule Mobilizon.Service.Activity.Renderer.Resource do
end end
defp resource_url(activity) do defp resource_url(activity) do
Endpoint ~p"/resource/#{activity.subject_params["resource_uuid"]}"
|> Routes.page_url(:resource, activity.subject_params["resource_uuid"]) |> url()
|> URI.decode() |> URI.decode()
end end

View File

@ -8,7 +8,7 @@ defmodule Mobilizon.Service.Auth.Applications do
alias Mobilizon.Service.Auth.Authenticator alias Mobilizon.Service.Auth.Authenticator
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias Mobilizon.Web.Auth.Guardian alias Mobilizon.Web.Auth.Guardian
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
require Logger require Logger
@app_access_tokens_ttl {8, :hour} @app_access_tokens_ttl {8, :hour}
@ -260,8 +260,7 @@ defmodule Mobilizon.Service.Auth.Applications do
with {:app, %Application{scope: app_scope} = application} <- with {:app, %Application{scope: app_scope} = application} <-
{:app, Applications.get_application_by_client_id(client_id)}, {:app, Applications.get_application_by_client_id(client_id)},
{device_code, user_code, verification_uri} <- {device_code, user_code, verification_uri} <-
{string_of_length(40), string_of_length(8), {string_of_length(40), string_of_length(8), url(~p"/login/device")},
Routes.page_url(Mobilizon.Web.Endpoint, :auth_device)},
{:scope_included, true} <- {:scope_included, request_scope_valid?(app_scope, scope)}, {:scope_included, true} <- {:scope_included, request_scope_valid?(app_scope, scope)},
{:ok, %ApplicationDeviceActivation{} = application_device_activation} <- {:ok, %ApplicationDeviceActivation{} = application_device_activation} <-
Applications.create_application_device_activation(%{ Applications.create_application_device_activation(%{

View File

@ -15,7 +15,7 @@ defmodule Mobilizon.Service.Export.Feed do
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
require Logger require Logger
@ -104,10 +104,7 @@ defmodule Mobilizon.Service.Export.Feed do
defp build_actor_feed(%Actor{} = actor, events, posts, public \\ true) do defp build_actor_feed(%Actor{} = actor, events, posts, public \\ true) do
display_name = Actor.display_name(actor) display_name = Actor.display_name(actor)
self_url = self_url = ~p"/@#{actor.preferred_username}/feed/atom" |> url() |> URI.decode()
Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "atom")
|> URI.decode()
title = title =
if public, if public,
@ -215,7 +212,7 @@ defmodule Mobilizon.Service.Export.Feed do
# Build an atom feed from actor and its public events # Build an atom feed from actor and its public events
@spec build_user_feed(list(Event.t()), User.t(), String.t()) :: String.t() @spec build_user_feed(list(Event.t()), User.t(), String.t()) :: String.t()
defp build_user_feed(events, %User{email: email}, token) do defp build_user_feed(events, %User{email: email}, token) do
self_url = Endpoint |> Routes.feed_url(:going, token, "atom") |> URI.decode() self_url = ~p"/events/going/#{token}/format" |> url() |> URI.decode()
# Title uses default instance language # Title uses default instance language
self_url self_url

View File

@ -2,9 +2,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
alias Phoenix.HTML alias Phoenix.HTML
alias Phoenix.HTML.Tag alias Phoenix.HTML.Tag
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
import Mobilizon.Service.Metadata.Utils, import Mobilizon.Service.Metadata.Utils,
only: [process_description: 2, default_description: 1, escape_text: 1] only: [process_description: 2, default_description: 1, escape_text: 1]
@ -25,13 +24,7 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
Tag.tag(:meta, property: "og:title", content: actor_display_name_escaped(group)), Tag.tag(:meta, property: "og:title", content: actor_display_name_escaped(group)),
Tag.tag(:meta, Tag.tag(:meta,
property: "og:url", property: "og:url",
content: content: ~p"/@#{Actor.preferred_username_and_domain(group)}" |> url() |> URI.decode()
Endpoint
|> Routes.page_url(
:actor,
Actor.preferred_username_and_domain(group)
)
|> URI.decode()
), ),
Tag.tag(:meta, property: "og:description", content: group.summary), Tag.tag(:meta, property: "og:description", content: group.summary),
Tag.tag(:meta, property: "og:type", content: "profile"), Tag.tag(:meta, property: "og:type", content: "profile"),
@ -91,20 +84,13 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
rel: "alternate", rel: "alternate",
type: "application/atom+xml", type: "application/atom+xml",
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(), title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
href: href: url(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")
Routes.feed_url(Endpoint, :actor, Actor.preferred_username_and_domain(group), :atom)
), ),
Tag.tag(:link, Tag.tag(:link,
rel: "alternate", rel: "alternate",
type: "text/calendar", type: "text/calendar",
title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(), title: gettext("%{name}'s feed", name: actor_display_name_escaped(group)) |> HTML.raw(),
href: href: url(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")
Routes.feed_url(
Endpoint,
:actor,
Actor.preferred_username_and_domain(group),
:ics
)
), ),
Tag.tag(:link, Tag.tag(:link,
rel: "alternate", rel: "alternate",

View File

@ -6,7 +6,7 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Events.Event do
alias Mobilizon.Events.{Event, EventOptions} alias Mobilizon.Events.{Event, EventOptions}
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
import Mobilizon.Service.Metadata.Utils, import Mobilizon.Service.Metadata.Utils,
only: [ only: [
@ -56,11 +56,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Events.Event do
"position" => 1, "position" => 1,
"name" => event.attributed_to |> Actor.display_name() |> escape_text(), "name" => event.attributed_to |> Actor.display_name() |> escape_text(),
"item" => "item" =>
Endpoint ~p"/@#{Actor.preferred_username_and_domain(event.attributed_to)}"
|> Routes.page_url( |> url()
:actor,
Actor.preferred_username_and_domain(event.attributed_to)
)
|> URI.decode() |> URI.decode()
}, },
%{ %{

View File

@ -9,7 +9,7 @@ defmodule Mobilizon.Service.Metadata.Instance do
alias Mobilizon.Config alias Mobilizon.Config
alias Mobilizon.Service.Metadata.Utils alias Mobilizon.Service.Metadata.Utils
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext import Mobilizon.Web.Gettext
@doc """ @doc """
@ -58,13 +58,13 @@ defmodule Mobilizon.Service.Metadata.Instance do
rel: "alternate", rel: "alternate",
type: "application/atom+xml", type: "application/atom+xml",
title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(), title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(),
href: Routes.feed_url(Endpoint, :instance, :atom) href: url(~p"/feed/instance/atom")
), ),
Tag.tag(:link, Tag.tag(:link,
rel: "alternate", rel: "alternate",
type: "text/calendar", type: "text/calendar",
title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(), title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(),
href: Routes.feed_url(Endpoint, :instance, :ics) href: url(~p"/feed/instance/ics")
) )
] ]
end end

View File

@ -4,9 +4,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Posts.Post do
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Medias.{File, Media} alias Mobilizon.Medias.{File, Media}
alias Mobilizon.Posts.Post alias Mobilizon.Posts.Post
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Service.Metadata.Utils, import Mobilizon.Service.Metadata.Utils,
only: [process_description: 2, strip_tags: 1, escape_text: 1] only: [process_description: 2, strip_tags: 1, escape_text: 1]
@ -35,11 +34,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Posts.Post do
"position" => 1, "position" => 1,
"name" => post.attributed_to |> Actor.display_name() |> escape_text, "name" => post.attributed_to |> Actor.display_name() |> escape_text,
"item" => "item" =>
Endpoint ~p"/@#{Actor.preferred_username_and_domain(post.attributed_to)}"
|> Routes.page_url( |> url()
:actor,
Actor.preferred_username_and_domain(post.attributed_to)
)
|> URI.decode() |> URI.decode()
}, },
%{ %{

View File

@ -6,14 +6,14 @@ defmodule Mobilizon.Service.SiteMap do
alias Mobilizon.{Actors, Events, Posts} alias Mobilizon.{Actors, Events, Posts}
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
@default_static_frequency :monthly @default_static_frequency :monthly
@spec generate_sitemap :: {:ok, :ok} @spec generate_sitemap :: {:ok, :ok}
def generate_sitemap do def generate_sitemap do
static_routes = [ static_routes = [
{Routes.page_url(Endpoint, :index, []), :daily}, {url(~p"/*path"), :daily},
"#{Endpoint.url()}/search", "#{Endpoint.url()}/search",
"#{Endpoint.url()}/about/instance", "#{Endpoint.url()}/about/instance",
"#{Endpoint.url()}/terms", "#{Endpoint.url()}/terms",

View File

@ -13,8 +13,7 @@ defmodule Mobilizon.Web.Cache.ActivityPub do
alias Mobilizon.Posts.Post alias Mobilizon.Posts.Post
alias Mobilizon.Resources.Resource alias Mobilizon.Resources.Resource
alias Mobilizon.Todos.{Todo, TodoList} alias Mobilizon.Todos.{Todo, TodoList}
alias Mobilizon.Web.Endpoint use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.Router.Helpers, as: Routes
@cache :activity_pub @cache :activity_pub
@ -73,7 +72,7 @@ defmodule Mobilizon.Web.Cache.ActivityPub do
{:commit, event} {:commit, event}
nil -> nil ->
with url <- Routes.page_url(Endpoint, :event, uuid), with url <- url(~p"/events/#{uuid}"),
%Tombstone{} = tomstone <- Tombstone.find_tombstone(url) do %Tombstone{} = tomstone <- Tombstone.find_tombstone(url) do
tomstone tomstone
else else

View File

@ -111,11 +111,8 @@ defmodule Mobilizon.Web.ApplicationController do
is_binary(state) and is_binary(scope) do is_binary(state) and is_binary(scope) do
redirect(conn, redirect(conn,
to: to:
Routes.page_path(conn, :authorize, url(
client_id: client_id, ~p"/oauth/authorize?#{[client_id: client_id, redirect_uri: redirect_uri, scope: scope, state: state]}"
redirect_uri: redirect_uri,
scope: scope,
state: state
) )
) )
else else

View File

@ -9,9 +9,6 @@ defmodule Mobilizon.Web.NodeInfoController do
alias Mobilizon.Config alias Mobilizon.Config
alias Mobilizon.Service.Statistics alias Mobilizon.Service.Statistics
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
@node_info_supported_versions ["2.0", "2.1"] @node_info_supported_versions ["2.0", "2.1"]
@node_info_schema_uri "http://nodeinfo.diaspora.software/ns/schema/" @node_info_schema_uri "http://nodeinfo.diaspora.software/ns/schema/"
@ -22,7 +19,7 @@ defmodule Mobilizon.Web.NodeInfoController do
|> Enum.map(fn version -> |> Enum.map(fn version ->
%{ %{
rel: @node_info_schema_uri <> version, rel: @node_info_schema_uri <> version,
href: Routes.node_info_url(Endpoint, :nodeinfo, version) href: url(~p"/.well-known/nodeinfo/#{version}")
} }
end) end)

View File

@ -3,9 +3,7 @@
<%= dgettext("activity", "%{profile} mentionned you in a comment under event %{event}.", %{ <%= dgettext("activity", "%{profile} mentionned you in a comment under event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -14,9 +12,7 @@
<%= dgettext("activity", "%{profile} has posted an announcement under event %{event}.", %{ <%= dgettext("activity", "%{profile} has posted an announcement under event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -26,9 +22,7 @@
<%= dgettext("activity", "%{profile} has posted a new reply under your event %{event}.", %{ <%= dgettext("activity", "%{profile} has posted a new reply under your event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}#comment-#{@activity.subject_params["comment_reply_to_uuid"]}-#{@activity.subject_params["comment_uuid"]}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}#comment-#{@activity.subject_params["comment_reply_to_uuid"]}-#{@activity.subject_params["comment_uuid"]}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -40,9 +34,7 @@
%{ %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}#comment-#{@activity.subject_params["comment_uuid"]}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}#comment-#{@activity.subject_params["comment_uuid"]}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
} }

View File

@ -4,22 +4,22 @@
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% :participation_event_comment -> %><%= dgettext("activity", "%{profile} has posted an announcement under event %{event}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% :participation_event_comment -> %><%= dgettext("activity", "%{profile} has posted an announcement under event %{event}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% :event_new_comment -> %><%= if @activity.subject_params["comment_reply_to"] do %><%=dgettext("activity", "%{profile} has posted a new reply under your event %{event}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% :event_new_comment -> %><%= if @activity.subject_params["comment_reply_to"] do %><%=dgettext("activity", "%{profile} has posted a new reply under your event %{event}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= "#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode()}#comment-#{@activity.subject_params["comment_reply_to_uuid"]}-#{@activity.subject_params["comment_uuid"]}" %><% else %><%= dgettext("activity", "%{profile} has posted a new comment under your event %{event}.", <%= "#{url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode()}#comment-#{@activity.subject_params["comment_reply_to_uuid"]}-#{@activity.subject_params["comment_uuid"]}" %><% else %><%= dgettext("activity", "%{profile} has posted a new comment under your event %{event}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= "#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode()}#comment-#{@activity.subject_params["comment_uuid"]}"%><% end %><% end %> <%= "#{url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode()}#comment-#{@activity.subject_params["comment_uuid"]}"%><% end %><% end %>

View File

@ -3,18 +3,14 @@
<%= dgettext("activity", "%{profile} mentionned you in a %{conversation}.", %{ <%= dgettext("activity", "%{profile} mentionned you in a %{conversation}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
conversation: conversation:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/conversations/#{@activity.subject_params["conversation_participant_id"]}" |> url() |> URI.decode()}\">conversation</a>"
:conversation,
@activity.subject_params["conversation_participant_id"]) |> URI.decode()}\">conversation</a>"
}) })
|> raw %> |> raw %>
<% :conversation_replied -> %> <% :conversation_replied -> %>
<%= dgettext("activity", "%{profile} replied you in a %{conversation}.", %{ <%= dgettext("activity", "%{profile} replied you in a %{conversation}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
conversation: conversation:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/conversations/#{@activity.subject_params["conversation_participant_id"]}" |> url() |> URI.decode()}\">conversation</a>"
:conversation,
@activity.subject_params["conversation_participant_id"]) |> URI.decode()}\">conversation</a>"
}) })
|> raw %> |> raw %>
<% end %> <% end %>

View File

@ -3,9 +3,9 @@
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :conversation, @activity.subject_params["conversation_participant_id"]) |> URI.decode() %><% :conversation_replied -> %><%= dgettext("activity", "%{profile} replied you in a conversation.", <%= url(~p"/conversations/#{@activity.subject_params["conversation_participant_id"]}") |> URI.decode() %><% :conversation_replied -> %><%= dgettext("activity", "%{profile} replied you in a conversation.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :conversation, @activity.subject_params["conversation_participant_id"]) |> URI.decode() %><% end %> <%= url(~p"/conversations/#{@activity.subject_params["conversation_participant_id"]}") |> URI.decode() %><% end %>

View File

@ -3,7 +3,7 @@
<%= dgettext("activity", "%{profile} created the discussion %{discussion}.", %{ <%= dgettext("activity", "%{profile} created the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion: discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\"> "<a href=\"#{~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>" #{escape_html(@activity.subject_params["discussion_title"])}</a>"
}) })
|> raw %> |> raw %>
@ -11,7 +11,7 @@
<%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.", %{ <%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion: discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\"> "<a href=\"#{~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>" #{escape_html(@activity.subject_params["discussion_title"])}</a>"
}) })
|> raw %> |> raw %>
@ -19,7 +19,7 @@
<%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.", %{ <%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion: discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\"> "<a href=\"#{~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>" #{escape_html(@activity.subject_params["discussion_title"])}</a>"
}) })
|> raw %> |> raw %>
@ -27,7 +27,7 @@
<%= dgettext("activity", "%{profile} archived the discussion %{discussion}.", %{ <%= dgettext("activity", "%{profile} archived the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
discussion: discussion:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode()}\"> "<a href=\"#{~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode()}\">
#{escape_html(@activity.subject_params["discussion_title"])}</a>" #{escape_html(@activity.subject_params["discussion_title"])}</a>"
}) })
|> raw %> |> raw %>

View File

@ -4,25 +4,25 @@
discussion: @activity.subject_params["discussion_title"] discussion: @activity.subject_params["discussion_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode() %><% :discussion_replied -> %><%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.", <%= ~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode() %><% :discussion_replied -> %><%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
discussion: @activity.subject_params["discussion_title"] discussion: @activity.subject_params["discussion_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode() %><% :discussion_renamed -> %><%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.", <%= ~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode() %><% :discussion_renamed -> %><%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
discussion: @activity.subject_params["discussion_title"] discussion: @activity.subject_params["discussion_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode() %><% :discussion_archived -> %><%= dgettext("activity", "%{profile} archived the discussion %{discussion}.", <%= ~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode() %><% :discussion_archived -> %><%= dgettext("activity", "%{profile} archived the discussion %{discussion}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
discussion: @activity.subject_params["discussion_title"] discussion: @activity.subject_params["discussion_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :discussion, Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group), @activity.subject_params["discussion_slug"]) |> URI.decode() %><% :discussion_deleted -> %><%= dgettext("activity", "%{profile} deleted the discussion %{discussion}.", <%= ~p"/#{Mobilizon.Actors.Actor.preferred_username_and_domain(@activity.group)}/c/#{@activity.subject_params["discussion_slug"]}" |> url() |> URI.decode() %><% :discussion_deleted -> %><%= dgettext("activity", "%{profile} deleted the discussion %{discussion}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
discussion: @activity.subject_params["discussion_title"] discussion: @activity.subject_params["discussion_title"]

View File

@ -3,9 +3,7 @@
<%= dgettext("activity", "The event %{event} was created by %{profile}.", %{ <%= dgettext("activity", "The event %{event} was created by %{profile}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -14,9 +12,7 @@
<%= dgettext("activity", "The event %{event} was updated by %{profile}.", %{ <%= dgettext("activity", "The event %{event} was updated by %{profile}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -32,9 +28,7 @@
<%= dgettext("activity", "%{profile} replied to a comment on the event %{event}.", %{ <%= dgettext("activity", "%{profile} replied to a comment on the event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -43,9 +37,7 @@
<%= dgettext("activity", "%{profile} posted a comment on the event %{event}.", %{ <%= dgettext("activity", "%{profile} posted a comment on the event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
}) })
@ -55,9 +47,7 @@
<%= dgettext("activity", "%{profile} joined your event %{event}.", %{ <%= dgettext("activity", "%{profile} joined your event %{event}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">#{escape_html(@activity.subject_params["event_title"])}</a>"
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">#{escape_html(@activity.subject_params["event_title"])}</a>"
}) })
|> raw %> |> raw %>
<% end %> <% end %>

View File

@ -4,13 +4,13 @@
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% :event_updated -> %><%= dgettext("activity", "The event %{event} was updated by %{profile}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% :event_updated -> %><%= dgettext("activity", "The event %{event} was updated by %{profile}.",
%{ %{
profile: display_name_and_username(@activity.author), profile: display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% :event_deleted -> %><%= dgettext("activity", "The event %{event} was deleted by %{profile}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% :event_deleted -> %><%= dgettext("activity", "The event %{event} was deleted by %{profile}.",
%{ %{
profile: display_name_and_username(@activity.author), profile: display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
@ -22,16 +22,16 @@
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} posted a comment on the event %{event}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} posted a comment on the event %{event}.",
%{ %{
profile: display_name_and_username(@activity.author), profile: display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% end %><% :event_new_participation -> %><%= dgettext("activity", "%{profile} joined your event %{event}.", <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% end %><% :event_new_participation -> %><%= dgettext("activity", "%{profile} joined your event %{event}.",
%{ %{
profile: display_name_and_username(@activity.author), profile: display_name_and_username(@activity.author),
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %><% end %> <%= url(~p"/events/#{@activity.subject_params["event_uuid"]}") |> URI.decode() %><% end %>

View File

@ -3,9 +3,7 @@
<%= dgettext("activity", "%{profile} created the group %{group}.", %{ <%= dgettext("activity", "%{profile} created the group %{group}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
group: group:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/@#{@activity.subject_params["group_federated_username"]}" |> url() |> URI.decode()}\">
:actor,
@activity.subject_params["group_federated_username"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["group_name"])} #{escape_html(@activity.subject_params["group_name"])}
</a>" </a>"
}) })
@ -14,9 +12,7 @@
<%= dgettext("activity", "%{profile} updated the group %{group}.", %{ <%= dgettext("activity", "%{profile} updated the group %{group}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
group: group:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/@#{@activity.subject_params["group_federated_username"]}" |> url() |> URI.decode()}\">
:actor,
@activity.subject_params["group_federated_username"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["group_name"])} #{escape_html(@activity.subject_params["group_name"])}
</a>" </a>"
}) })

View File

@ -4,10 +4,10 @@
group: @activity.subject_params["group_name"] group: @activity.subject_params["group_name"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, @activity.subject_params["group_federated_username"]) |> URI.decode() %><% :group_updated -> %><%= dgettext("activity", "%{profile} updated the group %{group}.", <%= ~p"/@#{@activity.subject_params["group_federated_username"]}" |> url() |> URI.decode() %><% :group_updated -> %><%= dgettext("activity", "%{profile} updated the group %{group}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
group: @activity.subject_params["group_name"] group: @activity.subject_params["group_name"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, @activity.subject_params["group_federated_username"]) |> URI.decode() %><% end %> <%= ~p"/@#{@activity.subject_params["group_federated_username"]}" |> url() |> URI.decode() %><% end %>

View File

@ -3,9 +3,7 @@
<%= dgettext("activity", "The post %{post} was created by %{profile}.", %{ <%= dgettext("activity", "The post %{post} was created by %{profile}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
post: post:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/p/#{@activity.subject_params["post_slug"]}" |> url() |> URI.decode()}\">
:post,
@activity.subject_params["post_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["post_title"])} #{escape_html(@activity.subject_params["post_title"])}
</a>" </a>"
}) })
@ -14,9 +12,7 @@
<%= dgettext("activity", "The post %{post} was updated by %{profile}.", %{ <%= dgettext("activity", "The post %{post} was updated by %{profile}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
post: post:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/p/#{@activity.subject_params["post_slug"]}" |> url() |> URI.decode()}\">
:post,
@activity.subject_params["post_slug"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["post_title"])} #{escape_html(@activity.subject_params["post_title"])}
</a>" </a>"
}) })

View File

@ -4,13 +4,13 @@
post: @activity.subject_params["post_title"] post: @activity.subject_params["post_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :post, @activity.subject_params["post_slug"]) |> URI.decode() %><% :post_updated -> %><%= dgettext("activity", "The post %{post} was updated by %{profile}.", <%= url(~p"/p/#{@activity.subject_params["post_slug"]}") |> URI.decode() %><% :post_updated -> %><%= dgettext("activity", "The post %{post} was updated by %{profile}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
post: @activity.subject_params["post_title"] post: @activity.subject_params["post_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :post, @activity.subject_params["post_slug"]) |> URI.decode() %><% :post_deleted -> %><%= dgettext("activity", "The post %{post} was deleted by %{profile}.", <%= url(~p"/p/#{@activity.subject_params["post_slug"]}") |> URI.decode() %><% :post_deleted -> %><%= dgettext("activity", "The post %{post} was deleted by %{profile}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
post: @activity.subject_params["post_title"] post: @activity.subject_params["post_title"]

View File

@ -4,9 +4,7 @@
<%= dgettext("activity", "%{profile} created the folder %{resource}.", %{ <%= dgettext("activity", "%{profile} created the folder %{resource}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>" </a>"
}) })
@ -15,9 +13,7 @@
<%= dgettext("activity", "%{profile} created the resource %{resource}.", %{ <%= dgettext("activity", "%{profile} created the resource %{resource}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>" </a>"
}) })
@ -31,9 +27,7 @@
%{ %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>", </a>",
old_resource_title: old_resource_title:
@ -48,9 +42,7 @@
%{ %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>", </a>",
old_resource_title: old_resource_title:
@ -64,9 +56,7 @@
<%= dgettext("activity", "%{profile} moved the folder %{resource}.", %{ <%= dgettext("activity", "%{profile} moved the folder %{resource}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>" </a>"
}) })
@ -75,9 +65,7 @@
<%= dgettext("activity", "%{profile} moved the resource %{resource}.", %{ <%= dgettext("activity", "%{profile} moved the resource %{resource}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>", profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
resource: resource:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/resource/#{@activity.subject_params["resource_uuid"]}" |> url() |> URI.decode()}\">
:resource,
@activity.subject_params["resource_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["resource_title"])} #{escape_html(@activity.subject_params["resource_title"])}
</a>" </a>"
}) })

View File

@ -5,39 +5,39 @@
resource: @activity.subject_params["resource_title"] resource: @activity.subject_params["resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} created the resource %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} created the resource %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"] resource: @activity.subject_params["resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% end %><% :resource_renamed -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} renamed the folder from %{old_resource_title} to %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% end %><% :resource_renamed -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} renamed the folder from %{old_resource_title} to %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"], resource: @activity.subject_params["resource_title"],
old_resource_title: @activity.subject_params["old_resource_title"] old_resource_title: @activity.subject_params["old_resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} renamed the resource from %{old_resource_title} to %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} renamed the resource from %{old_resource_title} to %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"], resource: @activity.subject_params["resource_title"],
old_resource_title: @activity.subject_params["old_resource_title"] old_resource_title: @activity.subject_params["old_resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% end %><% :resource_moved -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} moved the folder %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% end %><% :resource_moved -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} moved the folder %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"] resource: @activity.subject_params["resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} moved the resource %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% else %><%= dgettext("activity", "%{profile} moved the resource %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"] resource: @activity.subject_params["resource_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :resource, @activity.subject_params["resource_uuid"]) |> URI.decode() %><% end %><% :resource_deleted -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} deleted the folder %{resource}.", <%= url(~p"/resource/#{@activity.subject_params["resource_uuid"]}") |> URI.decode() %><% end %><% :resource_deleted -> %><%= if @activity.subject_params["is_folder"] do %><%= dgettext("activity", "%{profile} deleted the folder %{resource}.",
%{ %{
profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author), profile: Mobilizon.Actors.Actor.display_name_and_username(@activity.author),
resource: @activity.subject_params["resource_title"] resource: @activity.subject_params["resource_title"]

View File

@ -63,7 +63,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :participation_email_confirmation, @participant.metadata.confirmation_token)}" ~p"/participation/email/confirm/#{@participant.metadata.confirmation_token}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: 'Roboto', Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -2,5 +2,5 @@
== ==
<%= gettext "Hi there! You just registered to join this event: « %{title} ». Please confirm the e-mail address you provided:", title: @participant.event.title %> <%= gettext "Hi there! You just registered to join this event: « %{title} ». Please confirm the e-mail address you provided:", title: @participant.event.title %>
<%= gettext "If you didn't trigger this email, you may safely ignore it." %> <%= gettext "If you didn't trigger this email, you may safely ignore it." %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :participation_email_confirmation, @participant.metadata.confirmation_token) %> <%= url(~p"/participation/email/confirm/#{@participant.metadata.confirmation_token}") %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %> <%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %>

View File

@ -58,9 +58,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={~p"/events/#{@participant.event.uuid}" |> url() |> URI.decode()}
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @participant.event.uuid)}"
}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -2,5 +2,5 @@
== ==
<%= gettext "Get ready for %{title}", title: @participant.event.title %> <%= gettext "Get ready for %{title}", title: @participant.event.title %>
<%= gettext "Go to event page" %> <%= gettext "Go to event page" %>
<%= gettext "View the event on: %{link}", link: Routes.page_url(Mobilizon.Web.Endpoint, :event, @participant.event.uuid) %> <%= gettext "View the event on: %{link}", link: url(~p"/events/#{@participant.event.uuid}") %>
<%= gettext "If you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button." %> <%= gettext "If you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button." %>

View File

@ -54,9 +54,7 @@
profile: profile:
"<b>#{escape_html(display_name_and_username(@activity.author))}</b>", "<b>#{escape_html(display_name_and_username(@activity.author))}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])} #{escape_html(@activity.subject_params["event_title"])}
</a>" </a>"
} }
@ -77,7 +75,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"])}" ~p"/events/#{@activity.subject_params["event_uuid"]}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
@ -111,9 +111,7 @@
profile: profile:
"<b>#{escape_html(display_name_and_username(@activity.author))}</b>", "<b>#{escape_html(display_name_and_username(@activity.author))}</b>",
event: event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, "<a href=\"#{~p"/events/#{@activity.subject_params["conversation_event_uuid"]}" |> url() |> URI.decode()}\">#{escape_html(@activity.subject_params["conversation_event_title"])}</a>"
:event,
@activity.subject_params["conversation_event_uuid"]) |> URI.decode()}\">#{escape_html(@activity.subject_params["conversation_event_title"])}</a>"
} }
) )
|> raw %> |> raw %>
@ -174,7 +172,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["conversation_event_uuid"])}" ~p"/events/#{@activity.subject_params["conversation_event_uuid"]}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -9,7 +9,7 @@
event: @activity.subject_params["event_title"] event: @activity.subject_params["event_title"]
} }
) %> ) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["event_uuid"]) |> URI.decode() %> <%= ~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode() %>
<% :conversation -> %> <% :conversation -> %>
<%= dgettext("activity", "%{profile} has posted a private announcement about event %{event}.", <%= dgettext("activity", "%{profile} has posted a private announcement about event %{event}.",
%{ %{
@ -26,5 +26,5 @@
-- --
<%= dgettext("activity", "This information is sent privately to you as a person who registered for this event. Share the informations above with other people with caution.") %> <%= dgettext("activity", "This information is sent privately to you as a person who registered for this event. Share the informations above with other people with caution.") %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @activity.subject_params["conversation_event_uuid"]) |> URI.decode() %> <%= ~p"/events/#{@activity.subject_params["conversation_event_uuid"]}" |> url() |> URI.decode() %>
<% end %> <% end %>

View File

@ -61,9 +61,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={~p"/validate/email/#{@token}" |> url() |> URI.decode()}
"#{Routes.page_url(Mobilizon.Web.Endpoint, :user_email_validation, @token)}"
}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -1,5 +1,5 @@
<%= gettext "Confirm new email" %> <%= gettext "Confirm new email" %>
== ==
<%= gettext "Hi there! It seems like you wanted to change the email address linked to your account on %{instance}. If you still wish to do so, please click the button below to confirm the change. You will then be able to log in to %{instance} with this new email address.", %{instance: @instance_name} %> <%= gettext "Hi there! It seems like you wanted to change the email address linked to your account on %{instance}. If you still wish to do so, please click the button below to confirm the change. You will then be able to log in to %{instance} with this new email address.", %{instance: @instance_name} %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :user_email_validation, @token) %> <%= url(~p"/validate/email/#{@token}") %>
<%= gettext "If you didn't trigger the change yourself, please ignore this message." %> <%= gettext "If you didn't trigger the change yourself, please ignore this message." %>

View File

@ -94,7 +94,9 @@
<td width="85"> <td width="85">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)) |> URI.decode()}" ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="text-decoration: none;" style="text-decoration: none;"
@ -123,7 +125,9 @@
<td align="left"> <td align="left">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)) |> URI.decode()}" ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="text-decoration: none;color: #474467;font-family: 'Roboto', Helvetica, Arial, sans-serif;font-size: 18px;font-weight: bold;line-height: 25px;" style="text-decoration: none;color: #474467;font-family: 'Roboto', Helvetica, Arial, sans-serif;font-size: 18px;font-weight: bold;line-height: 25px;"
@ -138,7 +142,9 @@
<td align="left"> <td align="left">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)) |> URI.decode()}" ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="text-decoration: none;display: block;color: #7a7a7a;font-family: 'Roboto', Helvetica, Arial, sans-serif;font-size: 16px;font-weight: 400;line-height: 25px;" style="text-decoration: none;display: block;color: #7a7a7a;font-family: 'Roboto', Helvetica, Arial, sans-serif;font-size: 16px;font-weight: 400;line-height: 25px;"
@ -214,7 +220,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)) |> URI.decode()}/timeline" ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)}/timeline"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -21,7 +21,7 @@
<% end %> <% end %>
<%= if length(group_activities) > 5 do %> <%= if length(group_activities) > 5 do %>
<%= dngettext "activity", "View one more activity", "View %{count} more activities", length(group_activities) - 5, %{count: length(group_activities) - 5} %> <%= dngettext "activity", "View one more activity", "View %{count} more activities", length(group_activities) - 5, %{count: length(group_activities) - 5} %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)) |> URI.decode() %>/timeline <%= ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(hd(group_activities).group)}" |> url() |> URI.decode() %>/timeline
<% end %> <% end %>
<% end %> <% end %>
<%= dgettext("activity", "Don't want to receive activity notifications? You may change frequency or disable them in your settings.") %> <%= dgettext("activity", "Don't want to receive activity notifications? You may change frequency or disable them in your settings.") %>

View File

@ -74,7 +74,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"} href={~p"/events/#{@event.uuid}" |> url() |> URI.decode()}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -6,6 +6,6 @@
<%= gettext "Good news: one of the event organizers just approved your request. Update your calendar, because you're on the guest list now!" %> <%= gettext "Good news: one of the event organizers just approved your request. Update your calendar, because you're on the guest list now!" %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %> <%= ~p"/events/#{@event.uuid}" |> url() |> URI.decode() %>
<%= gettext "Would you wish to update or cancel your attendance, simply access the event page through the link above and click on the Attending button." %> <%= gettext "Would you wish to update or cancel your attendance, simply access the event page through the link above and click on the Attending button." %>

View File

@ -74,7 +74,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"} href={"#{url(~p"/events/#{@event.uuid}")}"}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -2,5 +2,5 @@
== ==
<%= gettext "You recently requested to attend %{title}.", title: @event.title %> <%= gettext "You recently requested to attend %{title}.", title: @event.title %>
<%= gettext "You have confirmed your participation. Update your calendar, because you're on the guest list now!" %> <%= gettext "You have confirmed your participation. Update your calendar, because you're on the guest list now!" %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %> <%= url(~p"/events/#{@event.uuid}") %>
<%= gettext "Would you wish to update or cancel your attendance, simply access the event page through the link above and click on the Attending button." %> <%= gettext "Would you wish to update or cancel your attendance, simply access the event page through the link above and click on the Attending button." %>

View File

@ -148,7 +148,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"} href={"#{url(~p"/events/#{@event.uuid}")}"}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -9,6 +9,6 @@
<%= gettext "New end date:" %> <%= render("date/event_tz_date.text", event: @event, date: @event.ends_on, timezone: @timezone, locale: @locale) %><% end %><%= if MapSet.member?(@changes, :physical_address) do %> <%= gettext "New end date:" %> <%= render("date/event_tz_date.text", event: @event, date: @event.ends_on, timezone: @timezone, locale: @locale) %><% end %><%= if MapSet.member?(@changes, :physical_address) do %>
<%= gettext "New location:" %> <%= Mobilizon.Addresses.Address.representation(@event.physical_address) %><% end %> <%= gettext "New location:" %> <%= Mobilizon.Addresses.Address.representation(@event.physical_address) %><% end %>
<%= gettext "Visit the updated event page: %{link}", link: Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %> <%= gettext "Visit the updated event page: %{link}", link: url(~p"/events/#{@event.uuid}") %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %> <%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %>

View File

@ -76,7 +76,7 @@
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :my_groups)}"} href={"#{url(~p"/groups/me")}"}
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"
> >

View File

@ -3,4 +3,4 @@
<%= gettext "%{inviter} just invited you to join their group %{group}", group: @group.name, inviter: @inviter.name %> <%= gettext "%{inviter} just invited you to join their group %{group}", group: @group.name, inviter: @inviter.name %>
<%= @group.url %> <%= @group.url %>
<%= gettext "To accept this invitation, head over to your groups." %> <%= gettext "To accept this invitation, head over to your groups." %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :my_groups) %> <%= url(~p"/groups/me") %>

View File

@ -48,7 +48,7 @@
"Your membership request for group %{link_start}<b>%{group}</b>%{link_end} has been approved.", "Your membership request for group %{link_start}<b>%{group}</b>%{link_end} has been approved.",
group: escape_html(display_name(@group)), group: escape_html(display_name(@group)),
link_start: link_start:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, preferred_username_and_domain(@group)) |> URI.decode()}\">", "<a href=\"#{~p"/@#{preferred_username_and_domain(@group)}" |> url() |> URI.decode()}\">",
link_end: "</a>" link_end: "</a>"
) )
|> raw %> |> raw %>
@ -66,7 +66,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(@group)) |> URI.decode()}" ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(@group)}"
|> url()
|> URI.decode()
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -2,4 +2,4 @@
== ==
<%= gettext "Your membership request for group %{group} has been approved.", group: Mobilizon.Actors.Actor.display_name(@group) %> <%= gettext "Your membership request for group %{group} has been approved.", group: Mobilizon.Actors.Actor.display_name(@group) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(@group)) |> URI.decode() %> <%= ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(@group)}" |> url() |> URI.decode() %>

View File

@ -48,7 +48,7 @@
"Your membership request for group %{link_start}<b>%{group}</b>%{link_end} has been rejected.", "Your membership request for group %{link_start}<b>%{group}</b>%{link_end} has been rejected.",
group: escape_html(display_name(@group)), group: escape_html(display_name(@group)),
link_start: link_start:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint, :actor, preferred_username_and_domain(@group)) |> URI.decode()}\">", "<a href=\"#{~p"/@#{preferred_username_and_domain(@group)}" |> url() |> URI.decode()}\">",
link_end: "</a>" link_end: "</a>"
) )
|> raw %> |> raw %>

View File

@ -2,4 +2,4 @@
== ==
<%= gettext "Your membership request for group %{group} has been rejected.", group: Mobilizon.Actors.Actor.display_name(@group) %> <%= gettext "Your membership request for group %{group} has been rejected.", group: Mobilizon.Actors.Actor.display_name(@group) %>
<%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(@group)) |> URI.decode() %> <%= ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(@group)}" |> url() |> URI.decode() %>

View File

@ -3,9 +3,9 @@
<%= ngettext "You have one event this week:", "You have %{total} events this week:", @total, total: @total %> <%= ngettext "You have one event this week:", "You have %{total} events this week:", @total, total: @total %>
<%= if @total > 1 do %> <%= if @total > 1 do %>
<%= for participation <- @participations do %> <%= for participation <- @participations do %>
- <%= render("date/event_tz_date.text", event: participation.event, date: participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= participation.event.title %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, participation.event.uuid) %> - <%= render("date/event_tz_date.text", event: participation.event, date: participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= participation.event.title %> <%= url(~p"/events/#{participation.event.uuid}") %>
<% end %> <% end %>
<% else %> <% else %>
<%= render("date/event_tz_date.text", event: @participation.event, date: @participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= @participation.event.title %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @participation.event.uuid) %> <%= render("date/event_tz_date.text", event: @participation.event, date: @participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= @participation.event.title %> <%= url(~p"/events/#{@participation.event.uuid}") %>
<% end %> <% end %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", @total %> <%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", @total %>

View File

@ -3,9 +3,9 @@
<%= ngettext "You have one event today:", "You have %{total} events today:", @total, total: @total %> <%= ngettext "You have one event today:", "You have %{total} events today:", @total, total: @total %>
<%= if @total > 1 do %> <%= if @total > 1 do %>
<%= for participation <- @participations do %> <%= for participation <- @participations do %>
- <%= render("date/event_tz_date.text", event: participation.event, date: participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= participation.event.title %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, participation.event.uuid) %> - <%= render("date/event_tz_date.text", event: participation.event, date: participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= participation.event.title %> <%= url(~p"/events/#{participation.event.uuid}") %>
<% end %> <% end %>
<% else %> <% else %>
<%= render("date/event_tz_date.text", event: @participation.event, date: @participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= @participation.event.title %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @participation.event.uuid) %> <%= render("date/event_tz_date.text", event: @participation.event, date: @participation.event.begins_on, timezone: @timezone, locale: @locale) %> - <%= @participation.event.title %> <%= url(~p"/events/#{@participation.event.uuid}") %>
<% end %> <% end %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", @total %> <%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", @total %>

View File

@ -7,7 +7,7 @@
align="left" align="left"
> >
<a <a
href={Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)} href={url(~p"/events/#{@event.uuid}")}
style="color: rgb(87,100,108); font-family: Helvetica,Arial,sans-serif; font-weight: normal; text-align: left; line-height: 1.3; text-decoration: none; vertical-align: baseline; margin: 0; padding: 0; border: 0;" style="color: rgb(87,100,108); font-family: Helvetica,Arial,sans-serif; font-weight: normal; text-align: left; line-height: 1.3; text-decoration: none; vertical-align: baseline; margin: 0; padding: 0; border: 0;"
target="_blank" target="_blank"
> >

View File

@ -7,7 +7,7 @@
align="left" align="left"
> >
<a <a
href={Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)} href={url(~p"/events/#{@event.uuid}")}
style="color: rgb(66,81,90); font-family: Helvetica,Arial,sans-serif; font-weight: 700; text-align: left; line-height: 1.4; text-decoration: none; vertical-align: baseline; font-size: 22px; letter-spacing: 0.2px; margin: 0 0 30px; padding: 0; border: 0;" style="color: rgb(66,81,90); font-family: Helvetica,Arial,sans-serif; font-weight: 700; text-align: left; line-height: 1.4; text-decoration: none; vertical-align: baseline; font-size: 22px; letter-spacing: 0.2px; margin: 0 0 30px; padding: 0; border: 0;"
target="_blank" target="_blank"
> >
@ -35,12 +35,11 @@
<%= if @event.attributed_to do %> <%= if @event.attributed_to do %>
<a <a
href={ href={
Routes.page_url( URI.decode(
Mobilizon.Web.Endpoint, url(
:actor, ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(@event.attributed_to)}"
Mobilizon.Actors.Actor.preferred_username_and_domain(@event.attributed_to) )
) )
|> URI.decode()
} }
style="color: rgb(254,56,89); font-family: Helvetica,Arial,sans-serif; font-weight: normal; text-align: left; line-height: 1.3; text-decoration: none; vertical-align: baseline; margin: 0; padding: 0; border: 0;" style="color: rgb(254,56,89); font-family: Helvetica,Arial,sans-serif; font-weight: normal; text-align: left; line-height: 1.3; text-decoration: none; vertical-align: baseline; margin: 0; padding: 0; border: 0;"
target="_blank" target="_blank"

View File

@ -1,3 +1,3 @@
<%= gettext("Title: %{title}", title: @event.title) %> <%= gettext("Title: %{title}", title: @event.title) %>
<%= if @event.attributed_to do %><%= gettext("Organizer: %{organizer}", organizer: @event.attributed_to.name || @event.attributed_to.preferred_username) %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :actor, Mobilizon.Actors.Actor.preferred_username_and_domain(@event.attributed_to)) |> URI.decode() %><% else %><%= gettext("Organizer: %{organizer}", organizer: @event.organizer_actor.name || @event.organizer_actor.preferred_username) %><% end %> <%= if @event.attributed_to do %><%= gettext("Organizer: %{organizer}", organizer: @event.attributed_to.name || @event.attributed_to.preferred_username) %> <%= ~p"/@#{Mobilizon.Actors.Actor.preferred_username_and_domain(@event.attributed_to)}" |> url() |> URI.decode() %><% else %><%= gettext("Organizer: %{organizer}", organizer: @event.organizer_actor.name || @event.organizer_actor.preferred_username) %><% end %>

View File

@ -40,7 +40,7 @@
align="center" align="center"
> >
<a <a
href={Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)} href={url(~p"/events/#{@event.uuid}")}
style="color: rgb(255,255,255); font-family: Helvetica,Arial,sans-serif; text-align: left; line-height: 14px; text-decoration: none; vertical-align: baseline; font-size: 20px; display: inline-block; border: 1px solid #3C376E; border-radius: 15px; white-space: nowrap; margin: 0; padding: 15px 25px; border: none;" style="color: rgb(255,255,255); font-family: Helvetica,Arial,sans-serif; text-align: left; line-height: 14px; text-decoration: none; vertical-align: baseline; font-size: 20px; display: inline-block; border: 1px solid #3C376E; border-radius: 15px; white-space: nowrap; margin: 0; padding: 15px 25px; border: none;"
target="_blank" target="_blank"
> >
@ -84,7 +84,7 @@
align="center" align="center"
> >
<a <a
href={Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)} href={url(~p"/events/#{@event.uuid}")}
style="color: rgb(255,255,255); font-family: Helvetica,Arial,sans-serif; text-align: left; line-height: 14px; text-decoration: none; vertical-align: baseline; font-size: 20px; display: inline-block; border: 1px solid #3C376E; border-radius: 15px; white-space: nowrap; margin: 0; padding: 15px 25px; border: none;" style="color: rgb(255,255,255); font-family: Helvetica,Arial,sans-serif; text-align: left; line-height: 14px; text-decoration: none; vertical-align: baseline; font-size: 20px; display: inline-block; border: 1px solid #3C376E; border-radius: 15px; white-space: nowrap; margin: 0; padding: 15px 25px; border: none;"
target="_blank" target="_blank"
> >
@ -125,7 +125,7 @@
align="left" align="left"
> >
<a <a
href={Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)} href={url(~p"/events/#{@event.uuid}")}
style="color: rgb(254,56,89); font-family: Helvetica,Arial,sans-serif; font-weight: 400; text-align: left; line-height: 1.5; text-decoration: none; vertical-align: baseline; font-size: 16px; margin: 0; padding: 0; border: 0;" style="color: rgb(254,56,89); font-family: Helvetica,Arial,sans-serif; font-weight: 400; text-align: left; line-height: 1.5; text-decoration: none; vertical-align: baseline; font-size: 16px; margin: 0; padding: 0; border: 0;"
target="_blank" target="_blank"
> >

View File

@ -2,8 +2,8 @@
<%= render("participation/card/_metadata.text", event: @event, timezone: @timezone, locale: @locale, action: @action) %> <%= render("participation/card/_metadata.text", event: @event, timezone: @timezone, locale: @locale, action: @action) %>
<%= case @action do %><% "participation" -> %><%= gettext("Manage your participation:") %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %><% "event" -> %><%= gettext("Participate:") %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %><% nil -> %><% end %> <%= case @action do %><% "participation" -> %><%= gettext("Manage your participation:") %> <%= url(~p"/events/#{@event.uuid}") %><% "event" -> %><%= gettext("Participate:") %> <%= url(~p"/events/#{@event.uuid}") %><% nil -> %><% end %>
<%= if @event.description do %><%= gettext("Details:") %> <%= if @event.description do %><%= gettext("Details:") %>
<%= process_description(@event.description) %> <%= process_description(@event.description) %>
<%= if String.length(@event.description) > 200 do %><%= gettext("Read more: %{url}", url: Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)) %><% end %><% end %> <%= if String.length(@event.description) > 200 do %><%= gettext("Read more: %{url}", url: url(~p"/events/#{@event.uuid}")) %><% end %><% end %>

View File

@ -81,7 +81,7 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) <> "/participations"}" "#{url(~p"/events/#{@event.uuid}") <> "/participations"}"
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -5,6 +5,6 @@
<%= render("participation/event_card.text", event: @event, timezone: @timezone, locale: @locale, action: nil) %> <%= render("participation/event_card.text", event: @event, timezone: @timezone, locale: @locale, action: nil) %>
<%= gettext "Manage pending requests" %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) <> "/participations" %> <%= gettext "Manage pending requests" %> <%= url(~p"/events/#{@event.uuid}") <> "/participations" %>
<%= gettext "You are receiving this email because you chose to get notifications for pending attendance requests to your events. You can disable or change your notification settings in your user account settings under « Notifications »." %>s <%= gettext "You are receiving this email because you chose to get notifications for pending attendance requests to your events. You can disable or change your notification settings in your user account settings under « Notifications »." %>s

View File

@ -227,7 +227,7 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E"> <td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a <a
href={ href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :moderation_report, @report.id)}" "#{url(~p"/moderation/report/#{@report.id}")}"
} }
target="_blank" target="_blank"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #3C376E; display: inline-block;"

View File

@ -23,4 +23,4 @@
<%= gettext "Reason" %> <%= gettext "Reason" %>
<%= @report.content %> <%= @report.content %>
<% end %> <% end %>
<%= gettext "View report:" %> <%= Routes.page_url(Mobilizon.Web.Endpoint, :moderation_report, @report.id) %> <%= gettext "View report:" %> <%= url(~p"/moderation/report/#{@report.id}") %>

View File

@ -8,7 +8,7 @@ defmodule Mobilizon.Web.EmailView do
alias Mobilizon.Service.Address alias Mobilizon.Service.Address
alias Mobilizon.Service.DateTime, as: DateTimeRenderer alias Mobilizon.Service.DateTime, as: DateTimeRenderer
alias Mobilizon.Service.Formatter.{HTML, Text} alias Mobilizon.Service.Formatter.{HTML, Text}
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext import Mobilizon.Web.Gettext
import Mobilizon.Service.Metadata.Utils, only: [process_description: 1] import Mobilizon.Service.Metadata.Utils, only: [process_description: 1]
import Phoenix.HTML, only: [raw: 1, html_escape: 1, safe_to_string: 1] import Phoenix.HTML, only: [raw: 1, html_escape: 1, safe_to_string: 1]

View File

@ -7,7 +7,6 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
alias Mobilizon.Posts.Post alias Mobilizon.Posts.Post
alias Mobilizon.Web.Endpoint alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Service.Metadata.Utils, import Mobilizon.Service.Metadata.Utils,
only: [process_description: 3] only: [process_description: 3]
@ -123,13 +122,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
"author" => %{ "author" => %{
"@type" => "Organization", "@type" => "Organization",
"name" => Actor.display_name(post.attributed_to), "name" => Actor.display_name(post.attributed_to),
"url" => "url" => URI.decode(url(~p"/@#{Actor.preferred_username_and_domain(post.attributed_to)}"))
Endpoint
|> Routes.page_url(
:actor,
Actor.preferred_username_and_domain(post.attributed_to)
)
|> URI.decode()
}, },
"datePublished" => post.publish_at, "datePublished" => post.publish_at,
"dateModified" => post.updated_at, "dateModified" => post.updated_at,
@ -156,7 +149,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
"reservationFor" => render("event.json", %{event: participant.event}), "reservationFor" => render("event.json", %{event: participant.event}),
"reservationStatus" => reservation_status(participant.role), "reservationStatus" => reservation_status(participant.role),
"modifiedTime" => participant.updated_at, "modifiedTime" => participant.updated_at,
"modifyReservationUrl" => Routes.page_url(Endpoint, :event, participant.event.uuid) "modifyReservationUrl" => url(~p"/events/#{participant.event.uuid}")
} }
if participant.code do if participant.code do

View File

@ -29,7 +29,7 @@ defmodule Mobilizon.Federation.ActivityPub.UtilsTest do
"content" => "My Comment", "content" => "My Comment",
"actor" => reply.actor.url, "actor" => reply.actor.url,
"uuid" => reply.uuid, "uuid" => reply.uuid,
"id" => Routes.page_url(Endpoint, :comment, reply.uuid), "id" => url(~p"/comments/#{reply.uuid}"),
"inReplyTo" => comment.url, "inReplyTo" => comment.url,
"attributedTo" => reply.actor.url, "attributedTo" => reply.actor.url,
"mediaType" => "text/html", "mediaType" => "text/html",

View File

@ -18,7 +18,7 @@ defmodule Mobilizon.Service.MetadataTest do
assert group |> Metadata.build_tags() |> Metadata.Utils.stringify_tags() == assert group |> Metadata.build_tags() |> Metadata.Utils.stringify_tags() ==
String.trim(""" String.trim("""
<meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(Routes.page_url(Endpoint, :actor, Actor.preferred_username_and_domain(group)))}" property="og:url"><meta content="The event organizer didn&#39;t add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><meta content="#{group.avatar.url}" property="og:image"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{Routes.feed_url(Endpoint, :actor, Actor.preferred_username_and_domain(group), "atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{Routes.feed_url(Endpoint, :actor, Actor.preferred_username_and_domain(group), "ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots"> <meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}")}" property="og:url"><meta content="The event organizer didn&#39;t add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><meta content="#{group.avatar.url}" property="og:image"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
""") """)
assert group assert group
@ -26,7 +26,7 @@ defmodule Mobilizon.Service.MetadataTest do
|> Metadata.build_tags() |> Metadata.build_tags()
|> Metadata.Utils.stringify_tags() == |> Metadata.Utils.stringify_tags() ==
String.trim(""" String.trim("""
<meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(Routes.page_url(Endpoint, :actor, Actor.preferred_username_and_domain(group)))}" property="og:url"><meta content="The event organizer didn&#39;t add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{Routes.feed_url(Endpoint, :actor, Actor.preferred_username_and_domain(group), "atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{Routes.feed_url(Endpoint, :actor, Actor.preferred_username_and_domain(group), "ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots"> <meta content="#{group.name}" property="og:title"><meta content="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}")}" property="og:url"><meta content="The event organizer didn&#39;t add any description." property="og:description"><meta content="profile" property="og:type"><meta content="#{Actor.preferred_username_and_domain(group)}" property="profile:username"><meta content="summary" property="twitter:card"><meta content="@joinmobilizon" property="twitter:site"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"#{group.name}","position":1}]}</script><script type="application/ld+json">{"@context":"http://schema.org","@type":"Organization","address":{"@type":"PostalAddress","addressCountry":"My Country","addressLocality":"My Locality","addressRegion":"My Region","postalCode":"My Postal Code","streetAddress":"My Street Address"},"image":"#{group.banner.url}","name":"#{group.name}","url":"#{group.url}"}</script><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/atom")}" rel="alternate" title="#{group.name}'s feed" type="application/atom+xml"><link href="#{URI.decode(~p"/@#{Actor.preferred_username_and_domain(group)}/feed/ics")}" rel="alternate" title="#{group.name}'s feed" type="text/calendar"><link href="#{group.url}" rel="alternate" type="application/activity+json"><link href="#{group.url}" rel="canonical"><meta content="noindex" name="robots">
""") """)
end end

View File

@ -9,7 +9,7 @@ defmodule Mobilizon.Factory do
alias Mobilizon.Crypto alias Mobilizon.Crypto
alias Mobilizon.Web.{Endpoint, Upload} alias Mobilizon.Web.{Endpoint, Upload}
alias Mobilizon.Web.Router.Helpers, as: Routes use Mobilizon.Web, :verified_routes
@spec user_factory :: Mobilizon.Users.User.t() @spec user_factory :: Mobilizon.Users.User.t()
def user_factory do def user_factory do
@ -173,7 +173,7 @@ defmodule Mobilizon.Factory do
origin_comment: nil, origin_comment: nil,
is_announcement: false, is_announcement: false,
published_at: DateTime.utc_now(), published_at: DateTime.utc_now(),
url: Routes.page_url(Endpoint, :comment, uuid) url: url(~p"/comments/#{uuid}")
} }
end end
@ -199,7 +199,7 @@ defmodule Mobilizon.Factory do
metadata: build_list(2, :event_metadata), metadata: build_list(2, :event_metadata),
local: true, local: true,
publish_at: DateTime.utc_now(), publish_at: DateTime.utc_now(),
url: Routes.page_url(Endpoint, :event, uuid), url: url(~p"/events/#{uuid}"),
picture: insert(:media), picture: insert(:media),
uuid: uuid, uuid: uuid,
join_options: :free, join_options: :free,
@ -344,7 +344,7 @@ defmodule Mobilizon.Factory do
title: sequence("todo list"), title: sequence("todo list"),
actor: build(:group), actor: build(:group),
id: uuid, id: uuid,
url: Routes.page_url(Endpoint, :todo_list, uuid), url: url(~p"/todo-list/#{uuid}"),
published_at: DateTime.utc_now() published_at: DateTime.utc_now()
} }
end end
@ -360,7 +360,7 @@ defmodule Mobilizon.Factory do
status: false, status: false,
due_date: Timex.shift(DateTime.utc_now(), hours: 2), due_date: Timex.shift(DateTime.utc_now(), hours: 2),
assigned_to: build(:actor), assigned_to: build(:actor),
url: Routes.page_url(Endpoint, :todo, uuid), url: url(~p"/todo/#{uuid}"),
creator: build(:actor), creator: build(:actor),
published_at: DateTime.utc_now() published_at: DateTime.utc_now()
} }
@ -379,7 +379,7 @@ defmodule Mobilizon.Factory do
actor: build(:group), actor: build(:group),
creator: build(:actor), creator: build(:actor),
parent: nil, parent: nil,
url: Routes.page_url(Endpoint, :resource, uuid), url: url(~p"/resource/#{uuid}"),
published_at: DateTime.utc_now(), published_at: DateTime.utc_now(),
path: "/#{title}" path: "/#{title}"
} }
@ -411,7 +411,7 @@ defmodule Mobilizon.Factory do
publish_at: DateTime.utc_now(), publish_at: DateTime.utc_now(),
picture: insert(:media), picture: insert(:media),
media: [], media: [],
url: Routes.page_url(Endpoint, :post, uuid) url: url(~p"/p/#{uuid}")
} }
end end
@ -440,7 +440,7 @@ defmodule Mobilizon.Factory do
id: uuid, id: uuid,
last_comment: nil, last_comment: nil,
comments: [], comments: [],
url: Routes.page_url(Endpoint, :discussion, group.preferred_username, slug) url: ~p"/@#{group.preferred_username}/c/#{slug}"
} }
end end

View File

@ -71,7 +71,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> get(Routes.page_url(Endpoint, :event, event.uuid)) |> get(url(~p"/events/#{event.uuid}"))
assert json_response(conn, 200) == assert json_response(conn, 200) ==
PageView.render("event.activity-json", %{conn: %{assigns: %{object: event}}}) PageView.render("event.activity-json", %{conn: %{assigns: %{object: event}}})
@ -83,7 +83,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.page_url(Endpoint, :event, event.uuid)) |> get(url(~p"/events/#{event.uuid}"))
assert json_response(conn, 404) assert json_response(conn, 404)
end end
@ -94,7 +94,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.page_url(Endpoint, :event, event.uuid)) |> get(url(~p"/events/#{event.uuid}"))
assert redirected_to(conn) == "https://someremote.url/events/here" assert redirected_to(conn) == "https://someremote.url/events/here"
end end
@ -107,7 +107,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.page_url(Endpoint, :comment, comment.uuid)) |> get(url(~p"/comments/#{comment.uuid}"))
assert json_response(conn, 200) == assert json_response(conn, 200) ==
PageView.render("comment.activity-json", %{conn: %{assigns: %{object: comment}}}) PageView.render("comment.activity-json", %{conn: %{assigns: %{object: comment}}})
@ -119,7 +119,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.page_url(Endpoint, :comment, comment.uuid)) |> get(url(~p"/comments/#{comment.uuid}"))
assert redirected_to(conn) == "https://someremote.url/comments/here" assert redirected_to(conn) == "https://someremote.url/comments/here"
end end
@ -130,7 +130,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.page_url(Endpoint, :comment, comment.uuid)) |> get(url(~p"/comments/#{comment.uuid}"))
assert json_response(conn, 404) assert json_response(conn, 404)
end end
@ -567,7 +567,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn conn
|> assign(:actor, remote_actor_2) |> assign(:actor, remote_actor_2)
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.activity_pub_url(Endpoint, :member, member.id)) |> get(url(~p"/member/#{member.id}"))
assert json_response(conn, 200) == assert json_response(conn, 200) ==
ActorView.render("member.json", %{member: member}) ActorView.render("member.json", %{member: member})
@ -590,7 +590,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn conn
|> assign(:actor, remote_actor_2) |> assign(:actor, remote_actor_2)
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.activity_pub_url(Endpoint, :member, member.id)) |> get(url(~p"/member/#{member.id}"))
assert redirected_to(conn) == "https://someremote.url/member/here" assert redirected_to(conn) == "https://someremote.url/member/here"
end end
@ -601,7 +601,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/activity+json") |> put_req_header("accept", "application/activity+json")
|> get(Routes.activity_pub_url(Endpoint, :member, member.id)) |> get(url(~p"/member/#{member.id}"))
assert json_response(conn, 404) assert json_response(conn, 404)
end end

View File

@ -134,7 +134,7 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
res = json_response(conn, 200) res = json_response(conn, 200)
verification_uri = Routes.page_url(Mobilizon.Web.Endpoint, :auth_device) verification_uri = url(~p"/login/device")
assert %{ assert %{
"device_code" => _device_code, "device_code" => _device_code,
@ -158,7 +158,7 @@ defmodule Mobilizon.Web.ApplicationControllerTest do
res = json_response(conn, 200) res = json_response(conn, 200)
verification_uri = Routes.page_url(Mobilizon.Web.Endpoint, :auth_device) verification_uri = url(~p"/login/device")
assert %{ assert %{
"device_code" => _device_code, "device_code" => _device_code,

View File

@ -26,7 +26,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn conn
|> get( |> get(
Endpoint Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "atom") |> ~p"/@#{actor.preferred_username}/feed/atom"
|> URI.decode() |> URI.decode()
) )
@ -63,7 +63,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn conn
|> get( |> get(
Endpoint Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "atom") |> ~p"/@#{actor.preferred_username}/feed/atom"
|> URI.decode() |> URI.decode()
) )
@ -79,7 +79,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
|> put_req_header("accept", "application/atom+xml") |> put_req_header("accept", "application/atom+xml")
|> get( |> get(
Endpoint Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "atom") |> ~p"/@#{actor.preferred_username}/feed/atom"
|> URI.decode() |> URI.decode()
) )
@ -132,11 +132,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> get( |> get(URI.decode(~p"/@#{group.preferred_username}/feed/ics"))
Endpoint
|> Routes.feed_url(:actor, group.preferred_username, "ics")
|> URI.decode()
)
assert res = response(conn, 200) assert res = response(conn, 200)
assert res =~ "BEGIN:VCALENDAR" assert res =~ "BEGIN:VCALENDAR"
@ -163,11 +159,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> get( |> get(URI.decode(~p"/@#{actor.preferred_username}/feed/ics"))
Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "ics")
|> URI.decode()
)
assert response(conn, 404) assert response(conn, 404)
end end
@ -179,11 +171,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "text/calendar") |> put_req_header("accept", "text/calendar")
|> get( |> get(URI.decode(~p"/@#{actor.preferred_username}/feed/ics"))
Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "ics")
|> URI.decode()
)
assert response(conn, 200) =~ "BEGIN:VCALENDAR" assert response(conn, 200) =~ "BEGIN:VCALENDAR"
assert response_content_type(conn, :calendar) =~ "charset=utf-8" assert response_content_type(conn, :calendar) =~ "charset=utf-8"
@ -209,7 +197,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn conn
|> get( |> get(
Endpoint Endpoint
|> Routes.feed_url(:event, event1.uuid, "ics") |> ~p"/events/#{event1.uuid}/export/ics"
|> URI.decode() |> URI.decode()
) )
@ -241,11 +229,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> get( |> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "atom"))
Endpoint
|> Routes.feed_url(:going, ShortUUID.encode!(feed_token.token), "atom")
|> URI.decode()
)
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
assert response_content_type(conn, :xml) =~ "charset=utf-8" assert response_content_type(conn, :xml) =~ "charset=utf-8"
@ -279,11 +263,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "application/atom+xml") |> put_req_header("accept", "application/atom+xml")
|> get( |> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "atom"))
Endpoint
|> Routes.feed_url(:going, ShortUUID.encode!(feed_token.token), "atom")
|> URI.decode()
)
assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" assert response(conn, 200) =~ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
assert response_content_type(conn, :xml) =~ "charset=utf-8" assert response_content_type(conn, :xml) =~ "charset=utf-8"
@ -301,11 +281,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
test "it returns 404 for an not existing feed", %{conn: conn} do test "it returns 404 for an not existing feed", %{conn: conn} do
conn = conn =
conn conn
|> get( |> get(URI.decode(~p"/events/going/not_existing/atom"))
Endpoint
|> Routes.feed_url(:going, "not existing", "atom")
|> URI.decode()
)
assert response(conn, 404) assert response(conn, 404)
end end
@ -329,11 +305,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "text/calendar") |> put_req_header("accept", "text/calendar")
|> get( |> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "ics"))
Endpoint
|> Routes.feed_url(:going, ShortUUID.encode!(feed_token.token), "ics")
|> URI.decode()
)
assert response(conn, 200) =~ "BEGIN:VCALENDAR" assert response(conn, 200) =~ "BEGIN:VCALENDAR"
assert response_content_type(conn, :calendar) =~ "charset=utf-8" assert response_content_type(conn, :calendar) =~ "charset=utf-8"
@ -363,11 +335,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn = conn =
conn conn
|> put_req_header("accept", "text/calendar") |> put_req_header("accept", "text/calendar")
|> get( |> get(URI.decode(~p"/events/going/#{ShortUUID.encode!(feed_token.token)}", "ics"))
Endpoint
|> Routes.feed_url(:going, ShortUUID.encode!(feed_token.token), "ics")
|> URI.decode()
)
assert response(conn, 200) =~ "BEGIN:VCALENDAR" assert response(conn, 200) =~ "BEGIN:VCALENDAR"
assert response_content_type(conn, :calendar) =~ "charset=utf-8" assert response_content_type(conn, :calendar) =~ "charset=utf-8"
@ -383,7 +351,7 @@ defmodule Mobilizon.Web.FeedControllerTest do
conn conn
|> get( |> get(
Endpoint Endpoint
|> Routes.feed_url(:going, "not existing", "ics") |> ~p"/events/going/not_existing/ics"
|> URI.decode() |> URI.decode()
) )

View File

@ -12,11 +12,11 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
assert json_response(conn, 200) == %{ assert json_response(conn, 200) == %{
"links" => [ "links" => [
%{ %{
"href" => Routes.node_info_url(Endpoint, :nodeinfo, "2.0"), "href" => ~p"/.well-known/nodeinfo/2.0Ã",
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0" "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"
}, },
%{ %{
"href" => Routes.node_info_url(Endpoint, :nodeinfo, "2.1"), "href" => ~p"/.well-known/nodeinfo/2.1",
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1" "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1"
} }
] ]

View File

@ -53,42 +53,42 @@ defmodule Mobilizon.Web.PageControllerTest do
test "GET /events/:uuid", %{conn: conn} do test "GET /events/:uuid", %{conn: conn} do
event = insert(:event, visibility: :public) event = insert(:event, visibility: :public)
conn = get(conn, Routes.page_url(Endpoint, :event, event.uuid)) conn = get(conn, url(~p"/events/#{event.uuid}"))
assert html_response(conn, 200) =~ event.title assert html_response(conn, 200) =~ event.title
end end
test "GET /events/:uuid with unlisted event", %{conn: conn} do test "GET /events/:uuid with unlisted event", %{conn: conn} do
event = insert(:event, visibility: :unlisted) event = insert(:event, visibility: :unlisted)
conn = get(conn, Routes.page_url(Endpoint, :event, event.uuid)) conn = get(conn, url(~p"/events/#{event.uuid}"))
assert html_response(conn, 200) =~ event.title assert html_response(conn, 200) =~ event.title
assert ["noindex"] == get_resp_header(conn, "x-robots-tag") assert ["noindex"] == get_resp_header(conn, "x-robots-tag")
end end
test "GET /events/:uuid with not existing event", %{conn: conn} do test "GET /events/:uuid with not existing event", %{conn: conn} do
conn = get(conn, Routes.page_url(Endpoint, :event, "not_existing_event")) conn = get(conn, ~p"/events/not_existing_event")
assert html_response(conn, 404) assert html_response(conn, 404)
end end
test "GET /events/:uuid with event not public", %{conn: conn} do test "GET /events/:uuid with event not public", %{conn: conn} do
event = insert(:event, visibility: :restricted) event = insert(:event, visibility: :restricted)
conn = get(conn, Routes.page_url(Endpoint, :event, event.uuid)) conn = get(conn, url(~p"/events/#{event.uuid}"))
assert html_response(conn, 404) assert html_response(conn, 404)
end end
test "GET /comments/:uuid", %{conn: conn} do test "GET /comments/:uuid", %{conn: conn} do
comment = insert(:comment) comment = insert(:comment)
conn = get(conn, Routes.page_url(Endpoint, :comment, comment.uuid)) conn = get(conn, url(~p"/comments/#{comment.uuid}"))
assert html_response(conn, 200) =~ comment.text assert html_response(conn, 200) =~ comment.text
end end
test "GET /comments/:uuid with not existing comment", %{conn: conn} do test "GET /comments/:uuid with not existing comment", %{conn: conn} do
conn = get(conn, Routes.page_url(Endpoint, :comment, "not_existing_comment")) conn = get(conn, ~p"/comments/not_existing_comment")
assert html_response(conn, 404) assert html_response(conn, 404)
end end
test "GET /comments/:uuid with comment not public", %{conn: conn} do test "GET /comments/:uuid with comment not public", %{conn: conn} do
comment = insert(:comment, visibility: :private) comment = insert(:comment, visibility: :private)
conn = get(conn, Routes.page_url(Endpoint, :comment, comment.uuid)) conn = get(conn, url(~p"/comments/#{comment.uuid}"))
assert html_response(conn, 404) assert html_response(conn, 404)
end end
end end