Query replaced
This commit is contained in:
parent
56f033fa95
commit
020112bf4a
1 changed files with 1 additions and 8 deletions
|
@ -1245,14 +1245,7 @@ function photos_content(App $a)
|
||||||
// The difference is that we won't be displaying the conversation head item
|
// 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
|
// as a "post" but displaying instead the photo it is linked to
|
||||||
|
|
||||||
/// @todo Rewrite this query. To do so, $sql_extra must be changed
|
$link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
|
||||||
$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']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
||||||
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], GRAVITY_COMMENT];
|
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], GRAVITY_COMMENT];
|
||||||
|
|
Loading…
Reference in a new issue