correct error-handling in newnotice
darcs-hash:20080521122604-84dde-bfcfe7b2a254f19ce56054f6e4c80317ed8aaf86.gz
This commit is contained in:
parent
53eeee70e7
commit
659feb5f43
@ -42,6 +42,7 @@ class NewnoticeAction extends Action {
|
||||
}
|
||||
|
||||
function save_new_notice() {
|
||||
|
||||
$user = common_current_user();
|
||||
assert($user); # XXX: maybe an error instead...
|
||||
$notice = DB_DataObject::factory('notice');
|
||||
@ -53,8 +54,10 @@ class NewnoticeAction extends Action {
|
||||
|
||||
if (!$notice->content) {
|
||||
$this->show_form(_t('No content!'));
|
||||
return;
|
||||
} else if (strlen($notice->content) > 140) {
|
||||
$this->show_form(_t('Notice content too long.'));
|
||||
return;
|
||||
}
|
||||
|
||||
return $notice->insert();
|
||||
|
Loading…
Reference in New Issue
Block a user