1
1
Fork 0

Add dismissed field to Mastodon API Notification types

This commit is contained in:
Hank Grabowski 2022-11-30 14:23:20 -05:00
parent 35ca4961d2
commit a27ffda59f
2 changed files with 7 additions and 2 deletions

View file

@ -70,7 +70,9 @@ class Notification extends BaseFactory
$status = null; $status = null;
} }
return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status); $dismissed = $Notification->dismissed;
return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status, $dismissed);
} }
/** /**

View file

@ -56,6 +56,8 @@ class Notification extends BaseDataTransferObject
protected $type; protected $type;
/** @var string (Datetime) */ /** @var string (Datetime) */
protected $created_at; protected $created_at;
/** @var bool */
protected $dismissed;
/** @var Account */ /** @var Account */
protected $account; protected $account;
/** @var Status|null */ /** @var Status|null */
@ -66,12 +68,13 @@ class Notification extends BaseDataTransferObject
* *
* @throws HttpException\InternalServerErrorException|Exception * @throws HttpException\InternalServerErrorException|Exception
*/ */
public function __construct(int $id, string $type, \DateTime $created_at, Account $account = null, Status $status = null) public function __construct(int $id, string $type, \DateTime $created_at, Account $account = null, Status $status = null, bool $dismissed = false)
{ {
$this->id = (string)$id; $this->id = (string)$id;
$this->type = $type; $this->type = $type;
$this->created_at = $created_at->format(DateTimeFormat::JSON); $this->created_at = $created_at->format(DateTimeFormat::JSON);
$this->account = $account->toArray(); $this->account = $account->toArray();
$this->dismissed = $dismissed;
if (!empty($status)) { if (!empty($status)) {
$this->status = $status->toArray(); $this->status = $status->toArray();