apply review suggestions

This commit is contained in:
Joe 2024-02-15 15:00:25 -06:00 committed by Shish
parent 0f620da854
commit 2cc53a958e
2 changed files with 8 additions and 18 deletions

View file

@ -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;

View file

@ -48,7 +48,7 @@ class RelationshipsTheme extends Themelet
$child_thumb_html = "<div class='shm-relationships-child-thumbs'><div class='shm-child-thumbs'>";
foreach ($visible_children as $child) {
$child_summary_html .= "<a href='".make_link('post/view/'.$child->id)."'>#{$child->id}</a>, ";
$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 .= "</span><a href='#' id='relationships-child-toggle' class='shm-relationships-child-toggle'>« hide</a>";
@ -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 = "";