From 38c134668ad2975d94e3ef007878bf93952c48a4 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 15 Jul 2021 20:02:54 -0400 Subject: [PATCH] Add missing deleted filter on featured lookup (fixes philomena-dev/philomena#124) --- lib/philomena_web/controllers/activity_controller.ex | 1 + .../controllers/api/json/image/featured_controller.ex | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/philomena_web/controllers/activity_controller.ex b/lib/philomena_web/controllers/activity_controller.ex index acc29ac4..f0b8f013 100644 --- a/lib/philomena_web/controllers/activity_controller.ex +++ b/lib/philomena_web/controllers/activity_controller.ex @@ -73,6 +73,7 @@ defmodule PhilomenaWeb.ActivityController do featured_image = Image |> join(:inner, [i], f in ImageFeature, on: [image_id: i.id]) + |> where([i], i.hidden_from_users == false) |> filter_hidden(user, conn.params["hidden"]) |> order_by([i, f], desc: f.created_at) |> limit(1) diff --git a/lib/philomena_web/controllers/api/json/image/featured_controller.ex b/lib/philomena_web/controllers/api/json/image/featured_controller.ex index 3287cafb..6a2c5909 100644 --- a/lib/philomena_web/controllers/api/json/image/featured_controller.ex +++ b/lib/philomena_web/controllers/api/json/image/featured_controller.ex @@ -13,6 +13,7 @@ defmodule PhilomenaWeb.Api.Json.Image.FeaturedController do featured_image = Image |> join(:inner, [i], f in ImageFeature, on: [image_id: i.id]) + |> where([i], i.hidden_from_users == false) |> order_by([_i, f], desc: f.created_at) |> limit(1) |> preload([:user, :intensity, tags: :aliases])