Decode URI sent in notification payloads

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-17 16:19:35 +02:00
parent d1c31a5080
commit 691d71d9f7
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
6 changed files with 18 additions and 10 deletions

View file

@ -70,12 +70,13 @@ defmodule Mobilizon.Service.Activity.Renderer.Discussion do
end
defp discussion_url(activity) do
Routes.page_url(
Endpoint,
Endpoint
|> Routes.page_url(
:discussion,
Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"]
)
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)

View file

@ -71,11 +71,12 @@ defmodule Mobilizon.Service.Activity.Renderer.Event do
end
defp event_url(activity) do
Routes.page_url(
Endpoint,
Endpoint
|> Routes.page_url(
:event,
activity.subject_params["event_uuid"]
)
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)

View file

@ -50,7 +50,9 @@ defmodule Mobilizon.Service.Activity.Renderer.Group do
end
defp post_url(activity) do
Routes.page_url(Endpoint, :post, activity.subject_params["post_slug"])
Endpoint
|> Routes.page_url(:post, activity.subject_params["post_slug"])
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)

View file

@ -63,12 +63,13 @@ defmodule Mobilizon.Service.Activity.Renderer.Member do
end
defp member_url(activity) do
Routes.page_url(
Endpoint,
Endpoint
|> Routes.page_url(
:discussion,
Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"]
)
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)

View file

@ -70,12 +70,13 @@ defmodule Mobilizon.Service.Activity.Renderer.Post do
end
defp discussion_url(activity) do
Routes.page_url(
Endpoint,
Endpoint
|> Routes.page_url(
:discussion,
Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"]
)
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)

View file

@ -114,7 +114,9 @@ defmodule Mobilizon.Service.Activity.Renderer.Resource do
end
defp resource_url(activity) do
Routes.page_url(Endpoint, :resource, activity.subject_params["resource_uuid"])
Endpoint
|> Routes.page_url(:resource, activity.subject_params["resource_uuid"])
|> URI.decode()
end
defp profile(activity), do: Actor.display_name_and_username(activity.author)