X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Funsilence.php;h=f1305373df4146191d1b0dd857adfcbf5ed4646c;hb=9e89a177c76741f7e696f09d778bd8b151f84d3f;hp=7d282c3661e02deb9f931d6d05fa59d55a19b2fb;hpb=ef51cc9ad4a37d6dcd2129828284def1c90d7402;p=quix0rs-gnu-social.git diff --git a/actions/unsilence.php b/actions/unsilence.php index 7d282c3661..f1305373df 100644 --- a/actions/unsilence.php +++ b/actions/unsilence.php @@ -27,12 +27,10 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** - * Silence a user. + * Unsilence a user. * * @category Action * @package StatusNet @@ -40,50 +38,13 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class UnsilenceAction extends ProfileFormAction { - /** - * Check parameters - * - * @param array $args action arguments (URL, GET, POST) - * - * @return boolean success flag - */ - - function prepare($args) - { - if (!parent::prepare($args)) { - return false; - } - - $cur = common_current_user(); - - assert(!empty($cur)); // checked by parent - - if (!$cur->hasRight(Right::SILENCEUSER)) { - $this->clientError(_('You cannot silence users on this site.')); - return false; - } - - assert(!empty($this->profile)); // checked by parent - - if (!$this->profile->isSilenced()) { - $this->clientError(_('User is not silenced.')); - return false; - } - - return true; - } - - /** - * Silence a user. - * - * @return void - */ - function handlePost() { - $this->profile->unsilence(); + assert($this->scoped instanceof Profile); + assert($this->profile instanceof Profile); + + $this->profile->unsilenceAs($this->scoped); } }