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