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 end
defp discussion_url(activity) do defp discussion_url(activity) do
Routes.page_url( Endpoint
Endpoint, |> Routes.page_url(
:discussion, :discussion,
Actor.preferred_username_and_domain(activity.group), Actor.preferred_username_and_domain(activity.group),
activity.subject_params["discussion_slug"] activity.subject_params["discussion_slug"]
) )
|> URI.decode()
end end
defp profile(activity), do: Actor.display_name_and_username(activity.author) defp profile(activity), do: Actor.display_name_and_username(activity.author)

View File

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

View File

@ -50,7 +50,9 @@ defmodule Mobilizon.Service.Activity.Renderer.Group do
end end
defp post_url(activity) do 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 end
defp profile(activity), do: Actor.display_name_and_username(activity.author) defp profile(activity), do: Actor.display_name_and_username(activity.author)

View File

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

View File

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

View File

@ -114,7 +114,9 @@ defmodule Mobilizon.Service.Activity.Renderer.Resource do
end end
defp resource_url(activity) do 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 end
defp profile(activity), do: Actor.display_name_and_username(activity.author) defp profile(activity), do: Actor.display_name_and_username(activity.author)