forked from GNUsocial/gnu-social
- Fix bad argument being passed (error code) when invalid format specified
- Reformat whitespace
This commit is contained in:
parent
9bb48c36ea
commit
4bbb259baf
@ -99,32 +99,43 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(_('API method not found.'), $code = 404);
|
$this->clientError(
|
||||||
return;
|
_('API method not found.'),
|
||||||
|
404
|
||||||
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
|
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
|
||||||
$this->clientError(_('This method requires a POST or DELETE.'),
|
$this->clientError(
|
||||||
400, $this->format);
|
_('This method requires a POST or DELETE.'),
|
||||||
return;
|
400,
|
||||||
}
|
$this->format
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($this->notice)) {
|
if (empty($this->notice)) {
|
||||||
$this->clientError(_('No status found with that ID.'),
|
$this->clientError(
|
||||||
404, $this->format);
|
_('No status found with that ID.'),
|
||||||
return;
|
404, $this->format
|
||||||
}
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->user->id == $this->notice->profile_id) {
|
if ($this->user->id == $this->notice->profile_id) {
|
||||||
$replies = new Reply;
|
$replies = new Reply;
|
||||||
$replies->get('notice_id', $this->notice_id);
|
$replies->get('notice_id', $this->notice_id);
|
||||||
$replies->delete();
|
$replies->delete();
|
||||||
$this->notice->delete();
|
$this->notice->delete();
|
||||||
$this->showNotice();
|
$this->showNotice();
|
||||||
} else {
|
} else {
|
||||||
$this->clientError(_('You may not delete another user\'s status.'),
|
$this->clientError(
|
||||||
403, $this->format);
|
_('You may not delete another user\'s status.'),
|
||||||
}
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user