s/name/author/g

This commit is contained in:
swagg boi 2022-09-17 02:39:49 -04:00
parent 5435678de8
commit 18515197df
3 changed files with 17 additions and 18 deletions

View file

@ -24,7 +24,6 @@ Run the tests locally (against development environment)
## TODOs
1. Should replace all reference to 'name' to 'author', getting confused
1. Grow into full blown Mojo?
1. More granular tests
1. Document post_text.conf (whoopsie)

View file

@ -76,13 +76,13 @@ sub startup($self) {
$v = $c->validation if $c->req->method eq 'POST';
if ($v && $v->has_data) {
my $thread_author = $c->param('name' );
my $thread_title = $c->param('title');
my $thread_body = $c->param('post' );
my $thread_author = $c->param('author');
my $thread_title = $c->param('title' );
my $thread_body = $c->param('post' );
$v->required('name' )->size(1, 63 );
$v->required('title')->size(1, 127 );
$v->required('post' )->size(2, 4000);
$v->required('author')->size(1, 63 );
$v->required('title' )->size(1, 127 );
$v->required('post' )->size(2, 4000);
if ($v->has_error) {
$c->stash(status => 400)
@ -109,11 +109,11 @@ sub startup($self) {
$v = $c->validation if $c->req->method eq 'POST';
if ($v && $v->has_data) {
my $remark_name = $c->param('name');
my $remark_body = $c->param('post');
my $remark_author = $c->param('author');
my $remark_body = $c->param('post' );
$v->required('name')->size(1, 63 );
$v->required('post')->size(2, 4000);
$v->required('author')->size(1, 63 );
$v->required('post' )->size(2, 4000);
if ($v->has_error) {
$c->stash(status => 400)
@ -121,11 +121,11 @@ sub startup($self) {
else {
$c->remark->create(
$thread_id,
$remark_name,
$remark_author,
$remark_body
);
$c->session(author => $remark_name);
$c->session(author => $remark_author);
return $c->redirect_to(
'thread_page',

View file

@ -9,26 +9,26 @@ use Test::Mojo;
my $script = curfile->dirname->sibling('PostText.pl');
my $t = Test::Mojo->new($script);
my %valid_params = (
name => 'Anonymous',
author => 'Anonymous',
title => 'hi',
post => 'ayy... lmao'
);
my %invalid_title = (
name => 'Anonymous',
author => 'Anonymous',
title => '',
post => 'ayy... lmao'
);
my %invalid_post = (
name => 'Anonymous',
author => 'Anonymous',
title => 'hi',
post => 'a'
);
my %valid_remark = (
name => 'Anonymous',
author => 'Anonymous',
post => 'hi'
);
my %invalid_remark = (
name => 'Anonymous',
author => 'Anonymous',
post => 'a'
);