projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'bugfix/status-deletion' into 'develop'
[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 97ce147de9845ca00ac1e189b3b703883b17393e..39b2a766a503cc25ff8715e435d18ec6917f1c82 100644
(file)
--- a/
lib/pleroma/web/feed/tag_controller.ex
+++ b/
lib/pleroma/web/feed/tag_controller.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Feed.TagController do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Feed.TagController do
@@
-9,32
+9,31
@@
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_in_if_exist: 3]
-
def feed(conn, %{"tag" => raw_tag} = params) do
def feed(conn, %{"tag" => raw_tag} = params) do
-
tag
= parse_tag(raw_tag)
+
{format, tag}
= parse_tag(raw_tag)
activities =
activities =
- %{
"type" => ["Create"], "whole_db" => true, "tag" =>
tag}
- |>
put_in_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
- |> put_resp_content_type("application/
atom
+xml")
+ |> put_resp_content_type("application/
#{format}
+xml")
|> put_view(FeedView)
|> put_view(FeedView)
- |> render("tag.
xml
",
+ |> render("tag.
#{format}
",
activities: activities,
tag: tag,
feed_config: Config.get([:feed])
)
end
activities: activities,
tag: tag,
feed_config: Config.get([:feed])
)
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
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"] ->
Enum.join(tag, ".")
- _ ->
raw_tag
+ [format | tag] when format in ["atom", "rss"] ->
{format, Enum.join(tag, ".")}
+ _ ->
{"rss", raw_tag}
end
end
end
end
- defp parse_tag(raw_tag), do:
raw_tag
+ defp parse_tag(raw_tag), do:
{"rss", raw_tag}
end
end