diff --git a/lib/philomena_web/controllers/activity_controller.ex b/lib/philomena_web/controllers/activity_controller.ex index 453566039..3e85233c8 100644 --- a/lib/philomena_web/controllers/activity_controller.ex +++ b/lib/philomena_web/controllers/activity_controller.ex @@ -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( diff --git a/lib/philomena_web/templates/activity/_channel_strip.html.slime b/lib/philomena_web/templates/activity/_channel_strip.html.slime index 278cc6e99..fba29d068 100644 --- a/lib/philomena_web/templates/activity/_channel_strip.html.slime +++ b/lib/philomena_web/templates/activity/_channel_strip.html.slime @@ -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