szurubooru/src/Jobs/PreviewCommentJob.php
2014-05-02 09:51:34 +02:00

30 lines
592 B
PHP

<?php
class PreviewCommentJob extends AbstractJob
{
public function execute()
{
$user = Auth::getCurrentUser();
$text = CommentModel::validateText($this->getArgument(JobArgs::TEXT));
$comment = CommentModel::spawn();
$comment->setCommenter($user);
$comment->commentDate = time();
$comment->text = $text;
return $comment;
}
public function requiresPrivilege()
{
return Privilege::AddComment;
}
public function requiresAuthentication()
{
return true;
}
public function requiresConfirmedEmail()
{
return getConfig()->registration->needEmailForCommenting;
}
}