]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/unblock.php
replace all tabs with four spaces
[quix0rs-gnu-social.git] / actions / unblock.php
index 192beaab5b61eeade016745ca5b89a5457e65ac1..6a86c2bf0f9a48e6662bd6c8e27251d83d33c413 100644 (file)
@@ -32,12 +32,12 @@ class UnblockAction extends Action {
             return false;
         }
 
-               $token = $this->trimmed('token');
+        $token = $this->trimmed('token');
 
-               if (!$token || $token != common_session_token()) {
-                       $this->client_error(_('There was a problem with your session token. Try again, please.'));
-                       return;
-               }
+        if (!$token || $token != common_session_token()) {
+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            return;
+        }
 
         $id = $this->trimmed('unblockto');
 
@@ -67,20 +67,10 @@ class UnblockAction extends Action {
 
         $cur = common_current_user();
 
-        # Get the block record
-
-        $block = Profile_block::get($cur->id, $this->profile->id);
-
-        if (!$block) {
-            $this->client_error(_('That user is not blocked!'));
-            return;
-        }
-
-        $result = $block->delete();
+        $result = $cur->unblock($this->profile);
 
         if (!$result) {
-            common_log_db_error($block, 'DELETE', __FILE__);
-            $this->server_error(_('Could not delete block record.'));
+            $this->server_error(_('Error removing the block.'));
             return;
         }