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
1C29EE70E90ECED01AF28EC58D2575B5
2BB1D36656B423758A470021718FCB09
31CE26BC979C57B9E3CC97B40C290CE5
3529E7A4CECC24D02678820E6F521162
37E854EA3BDF7275C6A7631F80804EC4
3644C4E850300482AA409471EFE1EFB3
4E7C044C59E0BCB76AA826789998F624
53CBBEB6243FAF5C37249CBA17DE6F4C
5BCE3651A03711295046DE48BDFE007E
5C16A2AE6A24E4795F95DDE20EEC458E
5C4CED447689F00D9D1ACEB9B895ED29
630C0972985257251EDF89A7117DE423
90EB7E986B2A3A0C3851B6BF158ECD73
94ACF7B17C3FF42F64E57DD1DA936BD8
A32E125003F1EDFAD95C487C6A969725
ACF6272A1DBB3A2ABD96C0C120B5CA69

View File

@ -14,7 +14,7 @@ defmodule Mobilizon.Federation.WebFinger do
alias Mobilizon.Federation.WebFinger.XmlBuilder
alias Mobilizon.Service.HTTP.{HostMetaClient, WebfingerClient}
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
require Jason
require Logger
import SweetXml
@ -85,7 +85,7 @@ defmodule Mobilizon.Federation.WebFinger do
%{"rel" => "self", "type" => "application/activity+json", "href" => actor.url},
%{
"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)

View File

@ -9,8 +9,7 @@ defmodule Mix.Tasks.Mobilizon.Maintenance.DetectSpam do
alias Mobilizon.Service.AntiSpam
import Mix.Tasks.Mobilizon.Common
alias Mobilizon.Federation.ActivityPub.Actions
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
@shortdoc "Scan all profiles and events against spam detector and report them"
@ -163,9 +162,7 @@ defmodule Mix.Tasks.Mobilizon.Maintenance.DetectSpam do
end
defp handle_spam_event(event_id, event_title, event_uuid, organizer_actor_id, options) do
shell_info(
"Detected event #{event_title} as spam: #{Routes.page_url(Endpoint, :event, event_uuid)}"
)
shell_info("Detected event #{event_title} as spam: #{url(~p"/events/#{event_uuid}")}")
unless dry_run?(options) do
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.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext, only: [dgettext: 2]
import Mobilizon.Service.Guards, only: [is_valid_string: 1]
@ -445,7 +446,7 @@ defmodule Mobilizon.Actors.Actor do
# Relay has a special URI
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)
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.Mention
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
@type t :: %__MODULE__{
text: String.t(),
@ -160,7 +159,7 @@ defmodule Mobilizon.Discussions.Comment do
end
@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()
defp put_tags(changeset, %{"tags" => tags}),

View File

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

View File

@ -32,8 +32,7 @@ defmodule Mobilizon.Events.Event do
alias Mobilizon.Medias.Media
alias Mobilizon.Storage.Repo
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
@type t :: %__MODULE__{
id: integer(),
@ -140,7 +139,7 @@ defmodule Mobilizon.Events.Event do
@spec changeset(t | Ecto.Schema.t(), map) :: Changeset.t()
def changeset(%__MODULE__{} = event, attrs) do
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
|> cast(attrs, @attrs)

View File

@ -27,8 +27,7 @@ defmodule Mobilizon.Posts.Post do
alias Mobilizon.Medias.Media
alias Mobilizon.Posts.Post.TitleSlug
alias Mobilizon.Posts.PostVisibility
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext
@type t :: %__MODULE__{
@ -128,7 +127,7 @@ defmodule Mobilizon.Posts.Post do
@spec generate_url(String.t()) :: String.t()
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

View File

@ -5,8 +5,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Comment do
alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer
@ -78,11 +77,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Comment do
end
defp event_url(activity) do
Routes.page_url(
Endpoint,
:event,
activity.subject_params["event_uuid"]
)
url(~p"/events/#{activity.subject_params["event_uuid"]}")
end
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.Actors.Actor
alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer
@ -61,11 +60,7 @@ defmodule Mobilizon.Service.Activity.Renderer.Conversation do
end
defp conversation_url(activity) do
Routes.page_url(
Endpoint,
:conversation,
activity.subject_params["conversation_id"]
)
url(~p"/conversations/#{activity.subject_params["conversation_id"]}")
end
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.Actors.Actor
alias Mobilizon.Service.Activity.Renderer
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext, only: [dgettext: 3]
@behaviour Renderer
@ -113,12 +112,8 @@ defmodule Mobilizon.Service.Activity.Renderer.Discussion do
end
defp discussion_url(activity) do
Endpoint
|> Routes.page_url(
:discussion,
Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"]
)
~p"/@#{Actor.preferred_username_and_domain(activity.group)}/c/#{activity.subject_params["discussion_slug"]}"
|> url()
|> URI.decode()
end

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ defmodule Mobilizon.Service.Auth.Applications do
alias Mobilizon.Service.Auth.Authenticator
alias Mobilizon.Users.User
alias Mobilizon.Web.Auth.Guardian
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
require Logger
@app_access_tokens_ttl {8, :hour}
@ -260,8 +260,7 @@ defmodule Mobilizon.Service.Auth.Applications do
with {:app, %Application{scope: app_scope} = application} <-
{:app, Applications.get_application_by_client_id(client_id)},
{device_code, user_code, verification_uri} <-
{string_of_length(40), string_of_length(8),
Routes.page_url(Mobilizon.Web.Endpoint, :auth_device)},
{string_of_length(40), string_of_length(8), url(~p"/login/device")},
{:scope_included, true} <- {:scope_included, request_scope_valid?(app_scope, scope)},
{:ok, %ApplicationDeviceActivation{} = 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.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
require Logger
@ -104,10 +104,7 @@ defmodule Mobilizon.Service.Export.Feed do
defp build_actor_feed(%Actor{} = actor, events, posts, public \\ true) do
display_name = Actor.display_name(actor)
self_url =
Endpoint
|> Routes.feed_url(:actor, actor.preferred_username, "atom")
|> URI.decode()
self_url = ~p"/@#{actor.preferred_username}/feed/atom" |> url() |> URI.decode()
title =
if public,
@ -215,7 +212,7 @@ defmodule Mobilizon.Service.Export.Feed do
# Build an atom feed from actor and its public events
@spec build_user_feed(list(Event.t()), User.t(), String.t()) :: String.t()
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
self_url

View File

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

View File

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

View File

@ -9,7 +9,7 @@ defmodule Mobilizon.Service.Metadata.Instance do
alias Mobilizon.Config
alias Mobilizon.Service.Metadata.Utils
alias Mobilizon.Web.Endpoint
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext
@doc """
@ -58,13 +58,13 @@ defmodule Mobilizon.Service.Metadata.Instance do
rel: "alternate",
type: "application/atom+xml",
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,
rel: "alternate",
type: "text/calendar",
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

View File

@ -4,9 +4,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Posts.Post do
alias Mobilizon.Actors.Actor
alias Mobilizon.Medias.{File, Media}
alias Mobilizon.Posts.Post
alias Mobilizon.Web.Endpoint
use Mobilizon.Web, :verified_routes
alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Service.Metadata.Utils,
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,
"name" => post.attributed_to |> Actor.display_name() |> escape_text,
"item" =>
Endpoint
|> Routes.page_url(
:actor,
Actor.preferred_username_and_domain(post.attributed_to)
)
~p"/@#{Actor.preferred_username_and_domain(post.attributed_to)}"
|> url()
|> URI.decode()
},
%{

View File

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

View File

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

View File

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

View File

@ -9,9 +9,6 @@ defmodule Mobilizon.Web.NodeInfoController do
alias Mobilizon.Config
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_schema_uri "http://nodeinfo.diaspora.software/ns/schema/"
@ -22,7 +19,7 @@ defmodule Mobilizon.Web.NodeInfoController do
|> Enum.map(fn version ->
%{
rel: @node_info_schema_uri <> version,
href: Routes.node_info_url(Endpoint, :nodeinfo, version)
href: url(~p"/.well-known/nodeinfo/#{version}")
}
end)

View File

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

View File

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

View File

@ -3,9 +3,9 @@
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),
}
) %>
<%= 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}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
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>"
})
|> raw %>
@ -11,7 +11,7 @@
<%= dgettext("activity", "%{profile} replied to the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
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>"
})
|> raw %>
@ -19,7 +19,7 @@
<%= dgettext("activity", "%{profile} renamed the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
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>"
})
|> raw %>
@ -27,7 +27,7 @@
<%= dgettext("activity", "%{profile} archived the discussion %{discussion}.", %{
profile: "<b>#{escaped_display_name_and_username(@activity.author)}</b>",
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>"
})
|> raw %>

View File

@ -4,25 +4,25 @@
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),
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),
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),
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),
discussion: @activity.subject_params["discussion_title"]

View File

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

View File

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

View File

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

View File

@ -4,13 +4,13 @@
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),
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),
post: @activity.subject_params["post_title"]

View File

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

View File

@ -5,39 +5,39 @@
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),
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),
resource: @activity.subject_params["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),
resource: @activity.subject_params["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),
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),
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),
resource: @activity.subject_params["resource_title"]

View File

@ -63,7 +63,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
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"
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 "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 %>

View File

@ -58,9 +58,7 @@
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @participant.event.uuid)}"
}
href={~p"/events/#{@participant.event.uuid}" |> url() |> URI.decode()}
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;"
>

View File

@ -2,5 +2,5 @@
==
<%= gettext "Get ready for %{title}", title: @participant.event.title %>
<%= 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." %>

View File

@ -54,9 +54,7 @@
profile:
"<b>#{escape_html(display_name_and_username(@activity.author))}</b>",
event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint,
:event,
@activity.subject_params["event_uuid"]) |> URI.decode()}\">
"<a href=\"#{~p"/events/#{@activity.subject_params["event_uuid"]}" |> url() |> URI.decode()}\">
#{escape_html(@activity.subject_params["event_title"])}
</a>"
}
@ -77,7 +75,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
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"
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:
"<b>#{escape_html(display_name_and_username(@activity.author))}</b>",
event:
"<a href=\"#{Routes.page_url(Mobilizon.Web.Endpoint,
:event,
@activity.subject_params["conversation_event_uuid"]) |> URI.decode()}\">#{escape_html(@activity.subject_params["conversation_event_title"])}</a>"
"<a href=\"#{~p"/events/#{@activity.subject_params["conversation_event_uuid"]}" |> url() |> URI.decode()}\">#{escape_html(@activity.subject_params["conversation_event_title"])}</a>"
}
)
|> raw %>
@ -174,7 +172,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
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"
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"]
}
) %>
<%= 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 -> %>
<%= 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.") %>
<%= 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 %>

View File

@ -61,9 +61,7 @@
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :user_email_validation, @token)}"
}
href={~p"/validate/email/#{@token}" |> url() |> URI.decode()}
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;"
>

View File

@ -1,5 +1,5 @@
<%= 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} %>
<%= 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." %>

View File

@ -94,7 +94,9 @@
<td width="85">
<a
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"
style="text-decoration: none;"
@ -123,7 +125,9 @@
<td align="left">
<a
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"
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">
<a
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"
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">
<a
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"
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 %>
<%= 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} %>
<%= 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 %>
<%= 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>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"}
href={~p"/events/#{@event.uuid}" |> url() |> URI.decode()}
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;"
>

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!" %>
<%= 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." %>

View File

@ -74,7 +74,7 @@
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"}
href={"#{url(~p"/events/#{@event.uuid}")}"}
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;"
>

View File

@ -2,5 +2,5 @@
==
<%= 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!" %>
<%= 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." %>

View File

@ -148,7 +148,7 @@
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid)}"}
href={"#{url(~p"/events/#{@event.uuid}")}"}
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;"
>

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 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 %>

View File

@ -76,7 +76,7 @@
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={"#{Routes.page_url(Mobilizon.Web.Endpoint, :my_groups)}"}
href={"#{url(~p"/groups/me")}"}
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;"
>

View File

@ -3,4 +3,4 @@
<%= gettext "%{inviter} just invited you to join their group %{group}", group: @group.name, inviter: @inviter.name %>
<%= @group.url %>
<%= 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.",
group: escape_html(display_name(@group)),
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>"
)
|> raw %>
@ -66,7 +66,9 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
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"
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) %>
<%= 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.",
group: escape_html(display_name(@group)),
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>"
)
|> raw %>

View File

@ -2,4 +2,4 @@
==
<%= 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 %>
<%= if @total > 1 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 %>
<% 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 %>
<%= 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 %>
<%= if @total > 1 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 %>
<% 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 %>
<%= 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"
>
<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;"
target="_blank"
>

View File

@ -7,7 +7,7 @@
align="left"
>
<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;"
target="_blank"
>
@ -35,12 +35,11 @@
<%= if @event.attributed_to do %>
<a
href={
Routes.page_url(
Mobilizon.Web.Endpoint,
:actor,
Mobilizon.Actors.Actor.preferred_username_and_domain(@event.attributed_to)
URI.decode(
url(
~p"/@#{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;"
target="_blank"

View File

@ -1,3 +1,3 @@
<%= 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"
>
<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;"
target="_blank"
>
@ -84,7 +84,7 @@
align="center"
>
<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;"
target="_blank"
>
@ -125,7 +125,7 @@
align="left"
>
<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;"
target="_blank"
>

View File

@ -2,8 +2,8 @@
<%= 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:") %>
<%= 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">
<a
href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) <> "/participations"}"
"#{url(~p"/events/#{@event.uuid}") <> "/participations"}"
}
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;"

View File

@ -5,6 +5,6 @@
<%= 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

View File

@ -227,7 +227,7 @@
<td align="center" style="border-radius: 3px;" bgcolor="#3C376E">
<a
href={
"#{Routes.page_url(Mobilizon.Web.Endpoint, :moderation_report, @report.id)}"
"#{url(~p"/moderation/report/#{@report.id}")}"
}
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;"

View File

@ -23,4 +23,4 @@
<%= gettext "Reason" %>
<%= @report.content %>
<% 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.DateTime, as: DateTimeRenderer
alias Mobilizon.Service.Formatter.{HTML, Text}
alias Mobilizon.Web.Router.Helpers, as: Routes
use Mobilizon.Web, :verified_routes
import Mobilizon.Web.Gettext
import Mobilizon.Service.Metadata.Utils, only: [process_description: 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.Web.Endpoint
alias Mobilizon.Web.JsonLD.ObjectView
alias Mobilizon.Web.Router.Helpers, as: Routes
import Mobilizon.Service.Metadata.Utils,
only: [process_description: 3]
@ -123,13 +122,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
"author" => %{
"@type" => "Organization",
"name" => Actor.display_name(post.attributed_to),
"url" =>
Endpoint
|> Routes.page_url(
:actor,
Actor.preferred_username_and_domain(post.attributed_to)
)
|> URI.decode()
"url" => URI.decode(url(~p"/@#{Actor.preferred_username_and_domain(post.attributed_to)}"))
},
"datePublished" => post.publish_at,
"dateModified" => post.updated_at,
@ -156,7 +149,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
"reservationFor" => render("event.json", %{event: participant.event}),
"reservationStatus" => reservation_status(participant.role),
"modifiedTime" => participant.updated_at,
"modifyReservationUrl" => Routes.page_url(Endpoint, :event, participant.event.uuid)
"modifyReservationUrl" => url(~p"/events/#{participant.event.uuid}")
}
if participant.code do

View File

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

View File

@ -18,7 +18,7 @@ defmodule Mobilizon.Service.MetadataTest do
assert group |> Metadata.build_tags() |> Metadata.Utils.stringify_tags() ==
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
@ -26,7 +26,7 @@ defmodule Mobilizon.Service.MetadataTest do
|> Metadata.build_tags()
|> Metadata.Utils.stringify_tags() ==
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

View File

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

View File

@ -71,7 +71,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> get(Routes.page_url(Endpoint, :event, event.uuid))
|> get(url(~p"/events/#{event.uuid}"))
assert json_response(conn, 200) ==
PageView.render("event.activity-json", %{conn: %{assigns: %{object: event}}})
@ -83,7 +83,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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)
end
@ -94,7 +94,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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"
end
@ -107,7 +107,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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) ==
PageView.render("comment.activity-json", %{conn: %{assigns: %{object: comment}}})
@ -119,7 +119,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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"
end
@ -130,7 +130,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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)
end
@ -567,7 +567,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn
|> assign(:actor, remote_actor_2)
|> 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) ==
ActorView.render("member.json", %{member: member})
@ -590,7 +590,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn
|> assign(:actor, remote_actor_2)
|> 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"
end
@ -601,7 +601,7 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
conn =
conn
|> 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)
end

View File

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

View File

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

View File

@ -12,11 +12,11 @@ defmodule Mobilizon.Web.NodeInfoControllerTest do
assert json_response(conn, 200) == %{
"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"
},
%{
"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"
}
]

View File

@ -53,42 +53,42 @@ defmodule Mobilizon.Web.PageControllerTest do
test "GET /events/:uuid", %{conn: conn} do
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
end
test "GET /events/:uuid with unlisted event", %{conn: conn} do
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 ["noindex"] == get_resp_header(conn, "x-robots-tag")
end
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)
end
test "GET /events/:uuid with event not public", %{conn: conn} do
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)
end
test "GET /comments/:uuid", %{conn: conn} do
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
end
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)
end
test "GET /comments/:uuid with comment not public", %{conn: conn} do
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)
end
end