Merge pull request #392 from BytewaveMLP/activity-page-nsfw-channels

List NSFW channels on Activity page when enabled
This commit is contained in:
liamwhite 2025-01-01 21:32:29 -05:00 committed by GitHub
commit 47fe5d5e5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

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(

View file

@ -8,6 +8,10 @@
/ => image_tag 'no_avatar_original.svg', width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image'
= @channel.title || @channel.short_name
.flex__fixed.flex__right
= if @channel.nsfw do
span title="NSFW"
' 🔞
'
= if @channel.is_live do
span.channel-strip__state.label.label--narrow.label--success
' LIVE NOW