my $message = "";
$params->{description} = $util->escape_html({}, $data->{title});
- $message = "no title!" if !$params->{title};
+ $message = "no title!" if !$params->{description};
- # check author is valid
- my $author = $users->select(nickname => $data->{author});
- if (!defined $author || !$author->{login}) {
+ # check user is valid
+ if (!defined $user || !$user->{login}) {
$message = "invalid author";
}
- $params->{uid} = $author->{uid};
+ $params->{uid} = $user->{uid};
$params->{article} = $data->{journal};
$params->{commentstatus} = $data->{comment_status};
$params->{action} = $data->{action} || 'preview';
#$extra_params->{createheaders} = $c->req->headers->to_string;
if (length($message) > 0) {
- #warn $message;
$c->render(json => { err => 1, message => $message });
$c->rendered(400);
return;