Shorten the notice text after command processing is done

This commit is contained in:
Craig Andrews 2009-10-27 22:02:55 -04:00
parent 922ee7b3b2
commit 7b30e3c00f

View File

@ -160,18 +160,12 @@ class NewnoticeAction extends Action
if (!$content) { if (!$content) {
$this->clientError(_('No content!')); $this->clientError(_('No content!'));
} else { return;
$content_shortened = common_shorten_links($content);
if (Notice::contentTooLong($content_shortened)) {
$this->clientError(sprintf(_('That\'s too long. '.
'Max notice size is %d chars.'),
Notice::maxContent()));
}
} }
$inter = new CommandInterpreter(); $inter = new CommandInterpreter();
$cmd = $inter->handle_command($user, $content_shortened); $cmd = $inter->handle_command($user, $content);
if ($cmd) { if ($cmd) {
if ($this->boolean('ajax')) { if ($this->boolean('ajax')) {
@ -182,6 +176,13 @@ class NewnoticeAction extends Action
return; return;
} }
$content_shortened = common_shorten_links($content);
if (Notice::contentTooLong($content_shortened)) {
$this->clientError(sprintf(_('That\'s too long. '.
'Max notice size is %d chars.'),
Notice::maxContent()));
}
$replyto = $this->trimmed('inreplyto'); $replyto = $this->trimmed('inreplyto');
#If an ID of 0 is wrongly passed here, it will cause a database error, #If an ID of 0 is wrongly passed here, it will cause a database error,
#so override it... #so override it...