Skip to content
Permalink
Browse files

Remove unnecessary where() calls in Posts::checkImage

  • Loading branch information...
SeinopSys committed Mar 22, 2019
1 parent 7ddc4a1 commit d1448a6670c91ea39859b50b63b2b2a69aecfeaa
Showing with 1 addition and 3 deletions.
  1. +1 −3 app/Posts.php
@@ -153,11 +153,9 @@ public static function checkImage($image_url, $Post = null){
foreach (Post::KINDS as $kind){
/** @noinspection DisconnectedForeachInstructionInspection */
if ($Post !== null)
DB::$instance->where('id',$Post->id,'!=');
if ($Image->preview !== null){
$already_used = Post::find_by_preview($Image->preview);
if (!empty($already_used))
if (!empty($already_used) && $already_used->id !== $Post->id)
Response::fail("This exact image has already been used for a {$already_used->toAnchor($kind,null,true)} under {$already_used->show->toAnchor()}");
}
}

0 comments on commit d1448a6

Please sign in to comment.
You can’t perform that action at this time.