From 9c7f8f164361b8103bea79d3daeff7e7e21e457f Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 3 Feb 2015 21:21:12 +0100 Subject: [PATCH] Inform API users if notice was deleted. --- actions/apistatusesshow.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 2a7702ee3c..8b9cc34779 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -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);