summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/block.php2
-rw-r--r--actions/showstream.php8
-rw-r--r--actions/unblock.php2
-rw-r--r--classes/Notice.php7
-rw-r--r--lib/router.php2
-rwxr-xr-xscripts/maildaemon.php14
6 files changed, 24 insertions, 11 deletions
diff --git a/actions/block.php b/actions/block.php
index 34f991dc6..0efee5932 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -180,7 +180,7 @@ class BlockAction extends Action
if ($action) {
common_redirect(common_local_url($action, $args), 303);
} else {
- common_redirect(common_local_url('subscriptions',
+ common_redirect(common_local_url('subscribers',
array('nickname' => $cur->nickname)),
303);
}
diff --git a/actions/showstream.php b/actions/showstream.php
index c1a2c337a..641228bc7 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -308,10 +308,14 @@ class ShowstreamAction extends ProfileAction
$blocked = $cur->hasBlocked($this->profile);
$this->elementStart('li', 'entity_block');
if ($blocked) {
- $ubf = new UnblockForm($this, $this->profile);
+ $ubf = new UnblockForm($this, $this->profile,
+ array('action' => 'showstream',
+ 'nickname' => $this->profile->nickname));
$ubf->show();
} else {
- $bf = new BlockForm($this, $this->profile);
+ $bf = new BlockForm($this, $this->profile,
+ array('action' => 'showstream',
+ 'nickname' => $this->profile->nickname));
$bf->show();
}
$this->elementEnd('li');
diff --git a/actions/unblock.php b/actions/unblock.php
index 8573b2a87..6e671c9dd 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -118,7 +118,7 @@ class UnblockAction extends Action
if ($action) {
common_redirect(common_local_url($action, $args), 303);
} else {
- common_redirect(common_local_url('subscriptions',
+ common_redirect(common_local_url('subscribers',
array('nickname' => $cur->nickname)),
303);
}
diff --git a/classes/Notice.php b/classes/Notice.php
index b4c86ebeb..bca4b22c4 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -123,7 +123,12 @@ class Notice extends Memcached_DataObject
$profile = Profile::staticGet($profile_id);
- $final = common_shorten_links($content);
+ $final = common_shorten_links($content);
+
+ if (mb_strlen($final) > 140) {
+ common_log(LOG_INFO, 'Rejecting notice that is too long.');
+ return _('Problem saving notice. Too long.');
+ }
if (!$profile) {
common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
diff --git a/lib/router.php b/lib/router.php
index 12590b790..748966567 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -101,7 +101,7 @@ class Router
$main = array('login', 'logout', 'register', 'subscribe',
'unsubscribe', 'confirmaddress', 'recoverpassword',
'invite', 'favor', 'disfavor', 'sup',
- 'block', 'subedit');
+ 'block', 'unblock', 'subedit');
foreach ($main as $a) {
$m->connect('main/'.$a, array('action' => $a));
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index b9facec1a..9dd647bf4 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -66,7 +66,13 @@ class MailerDaemon
return true;
}
$msg = $this->cleanup_msg($msg);
- $this->add_notice($user, $msg);
+ $err = $this->add_notice($user, $msg);
+ if (is_string($err)) {
+ $this->error($from, $err);
+ return false;
+ } else {
+ return true;
+ }
}
function error($from, $msg)
@@ -130,17 +136,15 @@ class MailerDaemon
function add_notice($user, $msg)
{
- // should test
- // $msg_shortened = common_shorten_links($msg);
- // if (mb_strlen($msg_shortened) > 140) ERROR and STOP
$notice = Notice::saveNew($user->id, $msg, 'mail');
if (is_string($notice)) {
$this->log(LOG_ERR, $notice);
- return;
+ return $notice;
}
common_broadcast_notice($notice);
$this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
+ return true;
}
function parse_message($fname)