X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiblockdestroy.php;h=666f308f4c5a3819ce1c83ff35e9fb9620c4b5d2;hb=54d2ed8b057025dee2ea8f531c6371e1008f4b89;hp=470b60ea5371980cdab578267487070fb3a4b1ff;hpb=061af8fa06ccb98f667d1ee670da2dbb179d8b0e;p=quix0rs-gnu-social.git diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index 470b60ea53..666f308f4c 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -21,6 +21,7 @@ * * @category API * @package StatusNet + * @author Evan Prodromou * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 @@ -39,6 +40,7 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * * @category API * @package StatusNet + * @author Evan Prodromou * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ @@ -46,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; class ApiBlockDestroyAction extends ApiAuthAction { - var $user = null; var $other = null; /** @@ -92,13 +93,20 @@ class ApiBlockDestroyAction extends ApiAuthAction } if (empty($this->user) || empty($this->other)) { - $this->clientError(_('No such user!'), 404, $this->format); + $this->clientError(_('No such user.'), 404, $this->format); return; } - if (!$this->user->hasBlocked($this->other) - || $this->user->unblock($this->other) - ) { + if ($this->user->hasBlocked($this->other)) { + if (Event::handle('StartUnblockProfile', array($this->user, $this->other))) { + $result = $this->user->unblock($this->other); + if ($result) { + Event::handle('EndUnblockProfile', array($this->user, $this->other)); + } + } + } + + if (!$this->user->hasBlocked($this->other)) { $this->initDocument($this->format); $this->showProfile($this->other, $this->format); $this->endDocument($this->format);