2021-05-15 10:08:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright Copyright (C) 2010-2021, the Friendica project
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Friendica\Module\Api\Mastodon\Notifications;
|
|
|
|
|
|
|
|
use Friendica\Core\System;
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
use Friendica\DI;
|
|
|
|
use Friendica\Module\BaseApi;
|
2021-09-18 04:03:32 +00:00
|
|
|
use Friendica\Network\HTTPException\ForbiddenException;
|
2021-05-15 10:08:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see https://docs.joinmastodon.org/methods/notifications/
|
|
|
|
*/
|
|
|
|
class Dismiss extends BaseApi
|
|
|
|
{
|
2021-11-14 22:13:47 +00:00
|
|
|
public function post()
|
2021-05-15 10:08:47 +00:00
|
|
|
{
|
2021-06-08 12:00:22 +00:00
|
|
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
2021-05-15 10:08:47 +00:00
|
|
|
$uid = self::getCurrentUserID();
|
|
|
|
|
2021-11-14 19:46:25 +00:00
|
|
|
if (empty(static::$parameters['id'])) {
|
2021-05-15 10:08:47 +00:00
|
|
|
DI::mstdnError()->UnprocessableEntity();
|
|
|
|
}
|
|
|
|
|
2021-11-14 19:46:25 +00:00
|
|
|
$Notification = DI::notification()->selectOneForUser($uid, static::$parameters['id']);
|
2021-09-18 04:03:32 +00:00
|
|
|
$Notification->setSeen();
|
|
|
|
DI::notification()->save($Notification);
|
2021-05-15 10:08:47 +00:00
|
|
|
|
|
|
|
System::jsonExit([]);
|
|
|
|
}
|
|
|
|
}
|