Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjoesGH authored and shish committed Feb 16, 2024
1 parent 0f620da commit 2cc53a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
12 changes: 5 additions & 7 deletions ext/relationships/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ public static function get_children(int $image_id): array
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
Expand Down Expand Up @@ -225,12 +223,12 @@ public static function has_siblings(int $image_id): bool
["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;
Expand Down
14 changes: 3 additions & 11 deletions ext/relationships/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function relationship_info(Image $image): void
$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>";
Expand Down Expand Up @@ -99,27 +99,19 @@ public function get_help_html(): string

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 = "";

Expand Down

0 comments on commit 2cc53a9

Please sign in to comment.