Change to more recent code style in ApiStatusesDestroyAction

This commit is contained in:
Mikael Nordfeldth 2016-02-28 19:23:13 +01:00
parent 781209a23b
commit 446c930823

View File

@ -68,8 +68,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction
{ {
parent::prepare($args); parent::prepare($args);
$this->user = $this->auth_user;
$this->profile = $this->auth_user->getProfile();
$this->notice_id = (int)$this->trimmed('id'); $this->notice_id = (int)$this->trimmed('id');
if (empty($notice_id)) { if (empty($notice_id)) {
@ -123,10 +121,10 @@ class ApiStatusesDestroyAction extends ApiAuthAction
return; return;
} }
if ($this->user->id == $this->notice->profile_id || $this->profile->hasRight(Right::DELETEOTHERSNOTICE)) { if ($this->scoped->sameAs($this->notice->getProfile()) || $this->scoped->hasRight(Right::DELETEOTHERSNOTICE)) {
if (Event::handle('StartDeleteOwnNotice', array($this->user, $this->notice))) { if (Event::handle('StartDeleteOwnNotice', array($this->auth_user, $this->notice))) {
$this->notice->deleteAs($this->scoped); $this->notice->deleteAs($this->scoped);
Event::handle('EndDeleteOwnNotice', array($this->user, $this->notice)); Event::handle('EndDeleteOwnNotice', array($this->auth_user, $this->notice));
} }
$this->showNotice(); $this->showNotice();
} else { } else {