From 17fd7b185054e260f0a9a2cedd264ff3ef43d725 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 8 Dec 2008 12:09:31 -0500 Subject: add returnto information to the block form darcs-hash:20081208170931-5ed1f-e7c5853e6a222b04723f20c01ebaae15eeab3687.gz --- actions/block.php | 24 ++++++++++++++++++++++-- actions/showstream.php | 11 +++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/block.php b/actions/block.php index b507af324..8956b79ba 100644 --- a/actions/block.php +++ b/actions/block.php @@ -95,6 +95,12 @@ class BlockAction extends Action { 'type' => 'hidden', 'value' => $id)); + foreach ($this->args as $k => $v) { + if (substr($k, 0, 9) == 'returnto-') { + common_hidden($k, $v); + } + } + common_submit('no', _('No')); common_submit('yes', _('Yes')); @@ -147,7 +153,21 @@ class BlockAction extends Action { $block->query('COMMIT'); - common_redirect(common_local_url('subscribers', - array('nickname' => $cur->nickname))); + # Now, gotta figure where we go back to + + foreach ($this->args as $k => $v) { + if ($k == 'returnto-action') { + $action = $v; + } else if (substr($k, 0, 9) == 'returnto-') { + $args[$k] = substr($k, 9); + } + } + + if ($action) { + common_redirect(common_local_url($action, $args)); + } else { + common_redirect(common_local_url('subscriptions', + array('nickname' => $cur->nickname))); + } } } diff --git a/actions/showstream.php b/actions/showstream.php index e12a227e3..0fc397811 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -203,8 +203,15 @@ class ShowstreamAction extends StreamAction { common_profile_new_message_nudge($cur, $user, $profile); if ($cur) { - common_element_start('li', array('id' => 'profile_block')); - common_block_form($profile); + $blocked = $cur->hasBlocked($profile); + common_element_start('li', array('id' => ($blocked) ? 'profile_unblock' : 'profile_block')); + if ($blocked) { +# common_unblock_form($profile, array('action' => 'showstream', +# 'nickname' => $profile->nickname)); + } else { + common_block_form($profile, array('action' => 'showstream', + 'nickname' => $profile->nickname)); + } common_element_end('li'); } -- cgit v1.2.3-54-g00ecf