]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/unsilence.php
[CORE][UI][ROUTER] Added view action, which inlines images and videos but downloads...
[quix0rs-gnu-social.git] / actions / unsilence.php
index 7d282c3661e02deb9f931d6d05fa59d55a19b2fb..f1305373df4146191d1b0dd857adfcbf5ed4646c 100644 (file)
  * @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);
     }
 }