mirror of
https://github.com/friendica/friendica
synced 2024-11-18 17:03:41 +00:00
Merge pull request #12304 from HankG/add-dismissed-field-to-mastodon-notifications
Add dismissed field to mastodon notifications
This commit is contained in:
commit
1b0f7e5add
3 changed files with 10 additions and 3 deletions
|
@ -70,7 +70,7 @@ class Notification extends BaseFactory
|
||||||
$status = null;
|
$status = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status);
|
return new MstdnNotification($Notification->id, $type, $Notification->created, $account, $status, $Notification->dismissed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,12 +63,16 @@ class Notifications extends BaseApi
|
||||||
'exclude_types' => [], // Array of types to exclude (follow, favourite, reblog, mention, poll, follow_request)
|
'exclude_types' => [], // Array of types to exclude (follow, favourite, reblog, mention, poll, follow_request)
|
||||||
'account_id' => 0, // Return only notifications received from this account
|
'account_id' => 0, // Return only notifications received from this account
|
||||||
'with_muted' => false, // Pleroma extension: return activities by muted (not by blocked!) users.
|
'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);
|
], $request);
|
||||||
|
|
||||||
$params = ['order' => ['id' => true]];
|
$params = ['order' => ['id' => true]];
|
||||||
|
|
||||||
$condition = ['uid' => $uid, 'dismissed' => false];
|
$condition = ['uid' => $uid, 'dismissed' => false];
|
||||||
|
if ($request['include_all']) {
|
||||||
|
$condition = ['uid' => $uid];
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($request['account_id'])) {
|
if (!empty($request['account_id'])) {
|
||||||
$contact = Contact::getById($request['account_id'], ['url']);
|
$contact = Contact::getById($request['account_id'], ['url']);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue