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