Show NSFW channels on Activity page when chan_nsfw is on

This commit is contained in:
Eliot Partridge 2025-01-01 15:22:16 -05:00
parent c328cb9cb5
commit ce0ae607dc
No known key found for this signature in database

View file

@ -82,8 +82,8 @@ defmodule PhilomenaWeb.ActivityController do
streams =
Channel
|> where([c], c.nsfw == false)
|> where([c], not is_nil(c.last_fetched_at))
|> maybe_show_nsfw_channels(conn.cookies["chan_nsfw"])
|> order_by(desc: :is_live, asc: :title)
|> limit(6)
|> Repo.all()
@ -142,6 +142,9 @@ defmodule PhilomenaWeb.ActivityController do
)
end
defp maybe_show_nsfw_channels(query, "true"), do: query
defp maybe_show_nsfw_channels(query, _falsy), do: where(query, [c], c.nsfw == false)
defp multi_search(images, top_scoring, comments, nil) do
responses =
Search.msearch_records(