projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Call ConfirmUserPlug from Router, not Endpoint
[akkoma]
/
lib
/
pleroma
/
web
/
feed
/
tag_controller.ex
diff --git
a/lib/pleroma/web/feed/tag_controller.ex
b/lib/pleroma/web/feed/tag_controller.ex
index 8133f8480366bc2c14c6fa36538b0435e3d928d4..218cdbdf3aa3c65f6341ee24150779f746250b96 100644
(file)
--- a/
lib/pleroma/web/feed/tag_controller.ex
+++ b/
lib/pleroma/web/feed/tag_controller.ex
@@
-9,14
+9,20
@@
defmodule Pleroma.Web.Feed.TagController do
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.Feed.FeedView
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.Feed.FeedView
- import Pleroma.Web.ControllerHelper, only: [put_if_exist: 3]
+ def feed(conn, params) do
+ if Config.get!([:instance, :public]) do
+ render_feed(conn, params)
+ else
+ render_error(conn, :not_found, "Not found")
+ end
+ end
- def
feed(conn, %{"tag" => raw_tag} = params) do
+ def
p render_
feed(conn, %{"tag" => raw_tag} = params) do
{format, tag} = parse_tag(raw_tag)
activities =
{format, tag} = parse_tag(raw_tag)
activities =
- %{
"type" => ["Create"], "tag" =>
tag}
- |>
put_if_exist("max_id"
, params["max_id"])
+ %{
type: ["Create"], tag:
tag}
+ |>
Pleroma.Maps.put_if_present(:max_id
, params["max_id"])
|> ActivityPub.fetch_public_activities()
conn
|> ActivityPub.fetch_public_activities()
conn
@@
-30,12
+36,13
@@
defmodule Pleroma.Web.Feed.TagController do
end
@spec parse_tag(binary() | any()) :: {format :: String.t(), tag :: String.t()}
end
@spec parse_tag(binary() | any()) :: {format :: String.t(), tag :: String.t()}
- defp parse_tag(raw_tag) when is_binary(raw_tag) do
- case Enum.reverse(String.split(raw_tag, ".")) do
- [format | tag] when format in ["atom", "rss"] -> {format, Enum.join(tag, ".")}
- _ -> {"rss", raw_tag}
+ defp parse_tag(raw_tag) do
+ case is_binary(raw_tag) && Enum.reverse(String.split(raw_tag, ".")) do
+ [format | tag] when format in ["rss", "atom"] ->
+ {format, Enum.join(tag, ".")}
+
+ _ ->
+ {"atom", raw_tag}
end
end
end
end
-
- defp parse_tag(raw_tag), do: {"rss", raw_tag}
end
end