Restructured some things to make it simpler and easier to read
This commit is contained in:
parent
db2f835adf
commit
f51af35605
|
@ -19,16 +19,18 @@ sub create($self) {
|
|||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
if ($v && $v->has_data) {
|
||||
my $remark_author = $self->param('author');
|
||||
my $remark_body = $self->param('body' );
|
||||
my ($remark_author, $remark_body);
|
||||
|
||||
$v->required('author')->size(1, 63 );
|
||||
$v->required('author')->size(1, 63);
|
||||
$v->required('body' )->size(2, 4000);
|
||||
|
||||
if ($v->has_error) {
|
||||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
$remark_author = $v->param('author');
|
||||
$remark_body = $v->param('body' );
|
||||
|
||||
$self->remark->create(
|
||||
$thread_id,
|
||||
$remark_author,
|
||||
|
|
|
@ -8,18 +8,20 @@ sub create($self) {
|
|||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
if ($v && $v->has_data) {
|
||||
my $thread_author = $self->param('author');
|
||||
my $thread_title = $self->param('title' );
|
||||
my $thread_body = $self->param('body' );
|
||||
my ($thread_author, $thread_title, $thread_body);
|
||||
|
||||
$v->required('author')->size(1, 63 );
|
||||
$v->required('title' )->size(1, 127 );
|
||||
$v->required('author')->size(1, 63);
|
||||
$v->required('title' )->size(1, 127);
|
||||
$v->required('body' )->size(2, 4000);
|
||||
|
||||
if ($v->has_error) {
|
||||
$self->stash(status => 400)
|
||||
}
|
||||
else {
|
||||
$thread_author = $v->param('author');
|
||||
$thread_title = $v->param('title' );
|
||||
$thread_body = $v->param('body' );
|
||||
|
||||
my $new_thread_id = $self->thread->create(
|
||||
$thread_author,
|
||||
$thread_title,
|
||||
|
|
Loading…
Reference in New Issue
Block a user