|
|
<?php |
|
|
|
|
|
namespace Kanboard\Action; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CommentCreation extends Base |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getDescription() |
|
|
{ |
|
|
return t('Create a comment from an external provider'); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getCompatibleEvents() |
|
|
{ |
|
|
return array(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getActionRequiredParameters() |
|
|
{ |
|
|
return array(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getEventRequiredParameters() |
|
|
{ |
|
|
return array( |
|
|
'task_id', |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function doAction(array $data) |
|
|
{ |
|
|
return (bool) $this->commentModel->create(array( |
|
|
'reference' => isset($data['reference']) ? $data['reference'] : '', |
|
|
'comment' => $data['comment'], |
|
|
'task_id' => $data['task_id'], |
|
|
'user_id' => isset($data['user_id']) && $this->projectPermissionModel->isAssignable($this->getProjectId(), $data['user_id']) ? $data['user_id'] : 0, |
|
|
)); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function hasRequiredCondition(array $data) |
|
|
{ |
|
|
return ! empty($data['comment']); |
|
|
} |
|
|
} |
|
|
|