diff --git a/src/Factory/Api/Mastodon/Notification.php b/src/Factory/Api/Mastodon/Notification.php index 32ea681dae..c85cfac786 100644 --- a/src/Factory/Api/Mastodon/Notification.php +++ b/src/Factory/Api/Mastodon/Notification.php @@ -70,7 +70,7 @@ class Notification extends BaseFactory $status = null; } - return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status); + return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status, $Notification->dismissed); } /** diff --git a/src/Module/Api/Mastodon/Notifications.php b/src/Module/Api/Mastodon/Notifications.php index 4ab71d88f9..8447362596 100644 --- a/src/Module/Api/Mastodon/Notifications.php +++ b/src/Module/Api/Mastodon/Notifications.php @@ -63,12 +63,16 @@ class Notifications extends BaseApi 'exclude_types' => [], // Array of types to exclude (follow, favourite, reblog, mention, poll, follow_request) 'account_id' => 0, // Return only notifications received from this account 'with_muted' => false, // Pleroma extension: return activities by muted (not by blocked!) users. - 'count' => 0, // Unknown parameter + 'count' => 0, + 'include_all' => false // Include dismissed and undismissed ], $request); $params = ['order' => ['id' => true]]; $condition = ['uid' => $uid, 'dismissed' => false]; + if ($request['include_all']) { + $condition = ['uid' => $uid]; + } if (!empty($request['account_id'])) { $contact = Contact::getById($request['account_id'], ['url']); diff --git a/src/Object/Api/Mastodon/Notification.php b/src/Object/Api/Mastodon/Notification.php index a54eda45df..aeec924130 100644 --- a/src/Object/Api/Mastodon/Notification.php +++ b/src/Object/Api/Mastodon/Notification.php @@ -56,6 +56,8 @@ class Notification extends BaseDataTransferObject protected $type; /** @var string (Datetime) */ protected $created_at; + /** @var bool */ + protected $dismissed; /** @var Account */ protected $account; /** @var Status|null */ @@ -66,12 +68,13 @@ class Notification extends BaseDataTransferObject * * @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->type = $type; $this->created_at = $created_at->format(DateTimeFormat::JSON); $this->account = $account->toArray(); + $this->dismissed = $dismissed; if (!empty($status)) { $this->status = $status->toArray();