From ef3d487ae02a6333b4e0f0714599ff1c3b7b729e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 8 Dec 2008 13:57:28 -0500 Subject: enable block API darcs-hash:20081208185728-5ed1f-8d5f6be6decfbb50deb4ca50bee13404d0c51b72.gz --- actions/block.php | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'actions/block.php') diff --git a/actions/block.php b/actions/block.php index fb553da6e..e6d2b7e49 100644 --- a/actions/block.php +++ b/actions/block.php @@ -118,41 +118,13 @@ class BlockAction extends Action { return; } - # Add a new block record - - $block = new Profile_block(); - - # Begin a transaction - - $block->query('BEGIN'); - - $block->blocker = $cur->id; - $block->blocked = $this->profile->id; - - $result = $block->insert(); + $result = $cur->block($this->profile); if (!$result) { - common_log_db_error($block, 'INSERT', __FILE__); - $this->server_error(_('Could not save new block record.')); + $this->server_error(_('Failed to save block information.')); return; } - # Cancel their subscription, if it exists - - $sub = Subscription::pkeyGet(array('subscriber' => $this->profile->id, - 'subscribed' => $cur->id)); - - if ($sub) { - $result = $sub->delete(); - if (!$result) { - common_log_db_error($sub, 'DELETE', __FILE__); - $this->server_error(_('Could not delete subscription.')); - return; - } - } - - $block->query('COMMIT'); - # Now, gotta figure where we go back to foreach ($this->args as $k => $v) { -- cgit v1.2.3-54-g00ecf