From 2cc53a958e1d61514eb812deabebadc35ce1cfe8 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 15 Feb 2024 15:00:25 -0600 Subject: [PATCH] apply review suggestions --- ext/relationships/main.php | 12 +++++------- ext/relationships/theme.php | 14 +++----------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ext/relationships/main.php b/ext/relationships/main.php index 603b7c49..d5f6c136 100644 --- a/ext/relationships/main.php +++ b/ext/relationships/main.php @@ -177,9 +177,7 @@ class Relationships extends Extension global $database; $child_ids = $database->get_col("SELECT id FROM images WHERE parent_id = :pid ", ["pid" => $image_id]); - $children = Search::get_images($child_ids); - - return $children; + return Search::get_images($child_ids); } private function remove_parent(int $imageID): void @@ -225,12 +223,12 @@ class Relationships extends Extension ["id" => $image_id, "pid" => $image['parent_id']] ); - if ($count > 0) { - return true; - } - return false; + return $count > 0; } + /** + * @return Image[] + */ public static function get_siblings(int $image_id): array { global $database; diff --git a/ext/relationships/theme.php b/ext/relationships/theme.php index 27fa122e..16d64f28 100644 --- a/ext/relationships/theme.php +++ b/ext/relationships/theme.php @@ -48,7 +48,7 @@ class RelationshipsTheme extends Themelet $child_thumb_html = "
"; foreach ($visible_children as $child) { $child_summary_html .= "id)."'>#{$child->id}, "; - $child_thumb_html .= $this->get_child_thumbnail_html(Image::by_id($child->id)); + $child_thumb_html .= $this->get_child_thumbnail_html($child); } $child_summary_html = rtrim($child_summary_html, ", ").")."; $child_summary_html .= "« hide"; @@ -99,27 +99,19 @@ class RelationshipsTheme extends Themelet private function get_parent_thumbnail_html(Image $image): HTMLElement { - global $user; - $parent_id = $image['parent_id']; $parent_image = Image::by_id($parent_id); - $html = $this->build_thumb_html($parent_image); - - return $html; + return $this->build_thumb_html($parent_image); } private function get_child_thumbnail_html(Image $image): HTMLElement { - $html = $this->build_thumb_html($image); - - return $html; + return $this->build_thumb_html($image); } private function get_sibling_thumbnail_html(Image $image): string { - global $user; - $siblings = Relationships::get_siblings($image->id); $html = "";