]> git.mxchange.org Git - friendica.git/commitdiff
Fix storing reports
authorMichael <heluecht@pirati.ca>
Fri, 23 Dec 2022 22:43:32 +0000 (22:43 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 23 Dec 2022 22:43:32 +0000 (22:43 +0000)
src/Moderation/Repository/Report.php

index 3ffc0de8afba2f789874aa8b05354dfb95a51793..75a7f06dcdb3914890ec0564464d65bcc3c8249f 100644 (file)
@@ -45,7 +45,7 @@ class Report extends \Friendica\BaseRepository
                $this->factory = $factory;
        }
 
-       public function selectOneById(int $lastInsertId): \Friendica\Moderation\Factory\Report
+       public function selectOneById(int $lastInsertId): \Friendica\Moderation\Entity\Report
        {
                return $this->_selectOne(['id' => $lastInsertId]);
        }
@@ -59,6 +59,8 @@ class Report extends \Friendica\BaseRepository
                        'forward' => $Report->forward,
                ];
 
+               $postUriIds = $Report->postUriIds;
+
                if ($Report->id) {
                        $this->db->update(self::$table_name, $fields, ['id' => $Report->id]);
                } else {
@@ -70,7 +72,7 @@ class Report extends \Friendica\BaseRepository
 
                $this->db->delete('report-post', ['rid' => $Report->id]);
 
-               foreach ($Report->postUriIds as $uriId) {
+               foreach ($postUriIds as $uriId) {
                        if (Post::exists(['uri-id' => $uriId])) {
                                $this->db->insert('report-post', ['rid' => $Report->id, 'uri-id' => $uriId]);
                        } else {