X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Funsilence.php;h=f1305373df4146191d1b0dd857adfcbf5ed4646c;hb=9e89a177c76741f7e696f09d778bd8b151f84d3f;hp=9ff1b828b03e59f0db8dd02cbef567ba58247cf7;hpb=bac2d80c919a78d5cafd57f712872a90cda04847;p=quix0rs-gnu-social.git diff --git a/actions/unsilence.php b/actions/unsilence.php index 9ff1b828b0..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); } }