s/name/author/g
This commit is contained in:
parent
5435678de8
commit
18515197df
|
@ -24,7 +24,6 @@ Run the tests locally (against development environment)
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
1. Should replace all reference to 'name' to 'author', getting confused
|
|
||||||
1. Grow into full blown Mojo?
|
1. Grow into full blown Mojo?
|
||||||
1. More granular tests
|
1. More granular tests
|
||||||
1. Document post_text.conf (whoopsie)
|
1. Document post_text.conf (whoopsie)
|
||||||
|
|
|
@ -76,12 +76,12 @@ sub startup($self) {
|
||||||
$v = $c->validation if $c->req->method eq 'POST';
|
$v = $c->validation if $c->req->method eq 'POST';
|
||||||
|
|
||||||
if ($v && $v->has_data) {
|
if ($v && $v->has_data) {
|
||||||
my $thread_author = $c->param('name' );
|
my $thread_author = $c->param('author');
|
||||||
my $thread_title = $c->param('title');
|
my $thread_title = $c->param('title' );
|
||||||
my $thread_body = $c->param('post' );
|
my $thread_body = $c->param('post' );
|
||||||
|
|
||||||
$v->required('name' )->size(1, 63 );
|
$v->required('author')->size(1, 63 );
|
||||||
$v->required('title')->size(1, 127 );
|
$v->required('title' )->size(1, 127 );
|
||||||
$v->required('post' )->size(2, 4000);
|
$v->required('post' )->size(2, 4000);
|
||||||
|
|
||||||
if ($v->has_error) {
|
if ($v->has_error) {
|
||||||
|
@ -109,11 +109,11 @@ sub startup($self) {
|
||||||
$v = $c->validation if $c->req->method eq 'POST';
|
$v = $c->validation if $c->req->method eq 'POST';
|
||||||
|
|
||||||
if ($v && $v->has_data) {
|
if ($v && $v->has_data) {
|
||||||
my $remark_name = $c->param('name');
|
my $remark_author = $c->param('author');
|
||||||
my $remark_body = $c->param('post');
|
my $remark_body = $c->param('post' );
|
||||||
|
|
||||||
$v->required('name')->size(1, 63 );
|
$v->required('author')->size(1, 63 );
|
||||||
$v->required('post')->size(2, 4000);
|
$v->required('post' )->size(2, 4000);
|
||||||
|
|
||||||
if ($v->has_error) {
|
if ($v->has_error) {
|
||||||
$c->stash(status => 400)
|
$c->stash(status => 400)
|
||||||
|
@ -121,11 +121,11 @@ sub startup($self) {
|
||||||
else {
|
else {
|
||||||
$c->remark->create(
|
$c->remark->create(
|
||||||
$thread_id,
|
$thread_id,
|
||||||
$remark_name,
|
$remark_author,
|
||||||
$remark_body
|
$remark_body
|
||||||
);
|
);
|
||||||
|
|
||||||
$c->session(author => $remark_name);
|
$c->session(author => $remark_author);
|
||||||
|
|
||||||
return $c->redirect_to(
|
return $c->redirect_to(
|
||||||
'thread_page',
|
'thread_page',
|
||||||
|
|
10
t/post.t
10
t/post.t
|
@ -9,26 +9,26 @@ use Test::Mojo;
|
||||||
my $script = curfile->dirname->sibling('PostText.pl');
|
my $script = curfile->dirname->sibling('PostText.pl');
|
||||||
my $t = Test::Mojo->new($script);
|
my $t = Test::Mojo->new($script);
|
||||||
my %valid_params = (
|
my %valid_params = (
|
||||||
name => 'Anonymous',
|
author => 'Anonymous',
|
||||||
title => 'hi',
|
title => 'hi',
|
||||||
post => 'ayy... lmao'
|
post => 'ayy... lmao'
|
||||||
);
|
);
|
||||||
my %invalid_title = (
|
my %invalid_title = (
|
||||||
name => 'Anonymous',
|
author => 'Anonymous',
|
||||||
title => '',
|
title => '',
|
||||||
post => 'ayy... lmao'
|
post => 'ayy... lmao'
|
||||||
);
|
);
|
||||||
my %invalid_post = (
|
my %invalid_post = (
|
||||||
name => 'Anonymous',
|
author => 'Anonymous',
|
||||||
title => 'hi',
|
title => 'hi',
|
||||||
post => 'a'
|
post => 'a'
|
||||||
);
|
);
|
||||||
my %valid_remark = (
|
my %valid_remark = (
|
||||||
name => 'Anonymous',
|
author => 'Anonymous',
|
||||||
post => 'hi'
|
post => 'hi'
|
||||||
);
|
);
|
||||||
my %invalid_remark = (
|
my %invalid_remark = (
|
||||||
name => 'Anonymous',
|
author => 'Anonymous',
|
||||||
post => 'a'
|
post => 'a'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue