We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 9c7f8f16 authored by mattl's avatar mattl

Inform API users if notice was deleted.

parent 3f7a305b
......@@ -74,7 +74,16 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
$this->notice_id = (int)$this->trimmed('id');
$this->notice = Notice::getKV($this->notice_id);
$this->notice = Notice::getKV('id', $this->notice_id);
if (!$this->notice instanceof Notice) {
$deleted = Deleted_notice::getKV('id', $this->notice_id);
if ($deleted instanceof Deleted_notice) {
// TRANS: Client error displayed trying to show a deleted notice.
$this->clientError(_('Notice deleted.'), 410);
// TRANS: Client error displayed trying to show a non-existing notice.
$this->clientError(_('No such notice.'), 404);
if (!$this->notice->inScope($this->scoped)) {
// TRANS: Client exception thrown when trying a view a notice the user has no access to.
throw new ClientException(_('Access restricted.'), 403);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment