From d5bc6d00060841a92cb5ca542b535c74f058976a Mon Sep 17 00:00:00 2001
From: Michael Vogel <icarus@dabo.de>
Date: Sat, 7 Jan 2023 19:54:13 +0100
Subject: [PATCH] Apply suggestions from code review

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
---
 mod/item.php         | 4 ++--
 src/Content/Item.php | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mod/item.php b/mod/item.php
index ca97f4e001..f43e78e6ba 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -156,7 +156,7 @@ function item_insert(int $uid, array $request, bool $preview, string $return_pat
 
 	if (!empty($request['parent'])) {
 		$parent_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $request['parent']]);
-		if (DBA::isResult($parent_item)) {
+		if ($parent_item) {
 			// if this isn't the top-level parent of the conversation, find it
 			if ($parent_item['gravity'] != Item::GRAVITY_PARENT) {
 				$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $parent_item['parent']]);
@@ -206,7 +206,7 @@ function item_insert(int $uid, array $request, bool $preview, string $return_pat
 	}
 
 	$post = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
-	if (!DBA::isResult($post)) {
+	if (!$post) {
 		Logger::error('Item couldn\'t be fetched.', ['post_id' => $post_id]);
 		if ($return_path) {
 			DI::baseUrl()->redirect($return_path);
diff --git a/src/Content/Item.php b/src/Content/Item.php
index 2518f4d318..a60b12663d 100644
--- a/src/Content/Item.php
+++ b/src/Content/Item.php
@@ -856,7 +856,7 @@ class Item
 		}
 
 		$user = User::getById($post['uid'], ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
-		if (!DBA::isResult($user)) {
+		if (!$user) {
 			throw new HTTPException\NotFoundException($this->l10n->t('Unable to locate original post.'));
 		}
 
-- 
2.39.5