}
case 'doc':
return common_path('doc/'.$args['title']);
+ case 'block':
case 'login':
case 'logout':
case 'subscribe':
$notice->update($orig);
}
}
+ # Don't save replies from blocked profile to local user
+ $recipient_user = User::staticGet('id', $recipient->id);
+ if ($recipient_user && $recipient_user->hasBlocked($sender)) {
+ continue;
+ }
$reply = new Reply();
$reply->notice_id = $notice->id;
$reply->profile_id = $recipient->id;
$tagged = Profile_tag::getTagged($sender->id, $tag);
foreach ($tagged as $t) {
if (!$replied[$t->id]) {
+ # Don't save replies from blocked profile to local user
+ $t_user = User::staticGet('id', $t->id);
+ if ($t_user && $t_user->hasBlocked($sender)) {
+ continue;
+ }
$reply = new Reply();
$reply->notice_id = $notice->id;
$reply->profile_id = $t->id;
}
function common_subscribe_form($profile) {
- common_element_start('form', array('id' => 'subscribe-' . $profile->nickname,
+ common_element_start('form', array('id' => 'subscribe-' . $profile->id,
'method' => 'post',
'class' => 'subscribe',
'action' => common_local_url('subscribe')));
common_hidden('token', common_session_token());
- common_element('input', array('id' => 'subscribeto-' . $profile->nickname,
+ common_element('input', array('id' => 'subscribeto-' . $profile->id,
'name' => 'subscribeto',
'type' => 'hidden',
- 'value' => $profile->nickname));
+ 'value' => $profile->id));
common_element('input', array('type' => 'submit',
'class' => 'submit',
'value' => _('Subscribe')));
# XXX: better compatibility check needed here!
return ($from == $to);
}
+
+function common_block_form($profile, $args=NULL) {
+ common_element_start('form', array('id' => 'block-' . $profile->id,
+ 'method' => 'post',
+ 'class' => 'block',
+ 'action' => common_local_url('block')));
+ common_hidden('token', common_session_token());
+ common_element('input', array('id' => 'blockto-' . $profile->id,
+ 'name' => 'blockto',
+ 'type' => 'hidden',
+ 'value' => $profile->id));
+ common_element('input', array('type' => 'submit',
+ 'class' => 'submit',
+ 'name' => 'block',
+ 'value' => _('Block')));
+ if ($args) {
+ foreach ($args as $k => $v) {
+ common_hidden('returnto-' . $k, $v);
+ }
+ }
+ common_element_end('form');
+ return;
+}