mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 14:17:59 +01:00
Merge pull request #392 from BytewaveMLP/activity-page-nsfw-channels
List NSFW channels on Activity page when enabled
This commit is contained in:
commit
47fe5d5e5c
2 changed files with 8 additions and 1 deletions
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue