Fix storing reports
This commit is contained in:
parent
ca12d1549b
commit
72e1d5d417
1 changed files with 4 additions and 2 deletions
|
@ -45,7 +45,7 @@ class Report extends \Friendica\BaseRepository
|
||||||
$this->factory = $factory;
|
$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]);
|
return $this->_selectOne(['id' => $lastInsertId]);
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ class Report extends \Friendica\BaseRepository
|
||||||
'forward' => $Report->forward,
|
'forward' => $Report->forward,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$postUriIds = $Report->postUriIds;
|
||||||
|
|
||||||
if ($Report->id) {
|
if ($Report->id) {
|
||||||
$this->db->update(self::$table_name, $fields, ['id' => $Report->id]);
|
$this->db->update(self::$table_name, $fields, ['id' => $Report->id]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +72,7 @@ class Report extends \Friendica\BaseRepository
|
||||||
|
|
||||||
$this->db->delete('report-post', ['rid' => $Report->id]);
|
$this->db->delete('report-post', ['rid' => $Report->id]);
|
||||||
|
|
||||||
foreach ($Report->postUriIds as $uriId) {
|
foreach ($postUriIds as $uriId) {
|
||||||
if (Post::exists(['uri-id' => $uriId])) {
|
if (Post::exists(['uri-id' => $uriId])) {
|
||||||
$this->db->insert('report-post', ['rid' => $Report->id, 'uri-id' => $uriId]);
|
$this->db->insert('report-post', ['rid' => $Report->id, 'uri-id' => $uriId]);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue