mirror of
https://github.com/friendica/friendica
synced 2025-04-27 13:50:12 +00:00
Reports: The reporting contact id is added
This commit is contained in:
parent
e9c6611965
commit
4c945850f4
9 changed files with 82 additions and 52 deletions
|
@ -35,6 +35,8 @@ class Report extends \Friendica\BaseEntity
|
|||
/** @var int|null */
|
||||
protected $id;
|
||||
/** @var int ID of the user making a moderation report*/
|
||||
protected $reporterId;
|
||||
/** @var int ID of the contact making a moderation report*/
|
||||
protected $uid;
|
||||
/** @var int ID of the contact being reported*/
|
||||
protected $cid;
|
||||
|
@ -47,9 +49,10 @@ class Report extends \Friendica\BaseEntity
|
|||
/** @var array Optional list of URI IDs of posts supporting the report*/
|
||||
protected $postUriIds;
|
||||
|
||||
public function __construct(int $uid, int $cid, \DateTime $created, string $comment = '', bool $forward = false, array $postUriIds = [], int $id = null)
|
||||
public function __construct(int $uid = null, int $reporterId, int $cid, \DateTime $created, string $comment = '', bool $forward = false, array $postUriIds = [], int $id = null)
|
||||
{
|
||||
$this->uid = $uid;
|
||||
$this->reporterId = $reporterId;
|
||||
$this->cid = $cid;
|
||||
$this->created = $created;
|
||||
$this->comment = $comment;
|
||||
|
|
|
@ -36,6 +36,7 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
|
|||
{
|
||||
return new Entity\Report(
|
||||
$row['uid'],
|
||||
$row['reporter-id'],
|
||||
$row['cid'],
|
||||
new \DateTime($row['created'] ?? 'now', new \DateTimeZone('UTC')),
|
||||
$row['comment'],
|
||||
|
@ -51,6 +52,7 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
|
|||
* @see \Friendica\Module\Api\Mastodon\Reports::post()
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $reporterId
|
||||
* @param int $cid
|
||||
* @param string $comment
|
||||
* @param bool $forward
|
||||
|
@ -58,10 +60,11 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
|
|||
* @return Entity\Report
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createFromReportsRequest(int $uid, int $cid, string $comment = '', bool $forward = false, array $postUriIds = []): Entity\Report
|
||||
public function createFromReportsRequest(int $uid = null, int $reporterId, int $cid, string $comment = '', bool $forward = false, array $postUriIds = []): Entity\Report
|
||||
{
|
||||
return new Entity\Report(
|
||||
$uid,
|
||||
$reporterId,
|
||||
$cid,
|
||||
new \DateTime('now', new \DateTimeZone('UTC')),
|
||||
$comment,
|
||||
|
|
|
@ -53,10 +53,11 @@ class Report extends \Friendica\BaseRepository
|
|||
public function save(\Friendica\Moderation\Entity\Report $Report)
|
||||
{
|
||||
$fields = [
|
||||
'uid' => $Report->uid,
|
||||
'cid' => $Report->cid,
|
||||
'comment' => $Report->comment,
|
||||
'forward' => $Report->forward,
|
||||
'uid' => $Report->uid,
|
||||
'reporter-id' => $Report->reporterId,
|
||||
'cid' => $Report->cid,
|
||||
'comment' => $Report->comment,
|
||||
'forward' => $Report->forward,
|
||||
];
|
||||
|
||||
$postUriIds = $Report->postUriIds;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue