From: Michael <heluecht@pirati.ca>
Date: Fri, 8 Oct 2021 10:28:28 +0000 (+0000)
Subject: Query replaced
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=020112bf4afeedbc5ae2d3eaac7c166c8ec8b56c;p=friendica.git

Query replaced
---

diff --git a/mod/photos.php b/mod/photos.php
index f3b907dd80..05767d4a4c 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1245,14 +1245,7 @@ function photos_content(App $a)
 		// The difference is that we won't be displaying the conversation head item
 		// as a "post" but displaying instead the photo it is linked to
 
-		/// @todo Rewrite this query. To do so, $sql_extra must be changed
-		$linked_items = q("SELECT `id` FROM `post-user-view` WHERE `resource-id` = '%s' $sql_extra LIMIT 1",
-			DBA::escape($datum)
-		);
-		if (DBA::isResult($linked_items)) {
-			// This is a workaround to not being forced to rewrite the while $sql_extra handling
-			$link_item = Post::selectFirst([], ['id' => $linked_items[0]['id']]);
-		}
+		$link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
 
 		if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
 			$condition = ["`parent` = ? AND `gravity` = ?",  $link_item['parent'], GRAVITY_COMMENT];