]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #8832 from annando/fix-db-error
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 30 Jun 2020 18:55:52 +0000 (14:55 -0400)
committerGitHub <noreply@github.com>
Tue, 30 Jun 2020 18:55:52 +0000 (14:55 -0400)
Fix database error ""Unknown column 'parent-item.author-id'"

src/Model/Item.php

index 1f339120ee0487ba6b9ad54c5b1fd84fd389a6ce..0872db3ca559d9acfcfc07ecb9deda8af18ed64b 100644 (file)
@@ -787,12 +787,12 @@ class Item
                        $joins .= " LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`";
                }
 
-               if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-author`.") !== false)) {
+               if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-item-author`.") !== false)) {
                        $joins .= " STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`";
-               }
 
-               if (strpos($sql_commands, "`parent-item-author`.") !== false) {
-                       $joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
+                       if (strpos($sql_commands, "`parent-item-author`.") !== false) {
+                               $joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
+                       }
                }
 
                return $joins;