diff options
| author | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
|---|---|---|
| committer | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
| commit | fe8e9cdcfe3afc1475c7e7f4392d2b2cc601a12b (patch) | |
| tree | 001403874e9e3716de7c6d51a9f536e9b3c3be5e /app/Model/TaskFileModel.php | |
| parent | b1e795fc5b45369f7b9b565b1e106d2673361977 (diff) | |
| parent | 98efcf21e355ed6ac3827058b99df86ca67c75bb (diff) | |
Merge branch 'stable' of https://github.com/kanboard/kanboard
Diffstat (limited to 'app/Model/TaskFileModel.php')
| -rw-r--r-- | app/Model/TaskFileModel.php | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/app/Model/TaskFileModel.php b/app/Model/TaskFileModel.php index 24c1ad4b..0163da28 100644 --- a/app/Model/TaskFileModel.php +++ b/app/Model/TaskFileModel.php @@ -61,15 +61,19 @@ class TaskFileModel extends FileModel } /** - * Get event name + * Get projectId from fileId * - * @abstract - * @access protected - * @return string + * @access public + * @param integer $file_id + * @return integer */ - protected function getEventName() + public function getProjectId($file_id) { - return self::EVENT_CREATE; + return $this->db + ->table(self::TABLE) + ->eq(self::TABLE.'.id', $file_id) + ->join(TaskModel::TABLE, 'id', 'task_id') + ->findOneColumn(TaskModel::TABLE . '.project_id') ?: 0; } /** @@ -85,4 +89,15 @@ class TaskFileModel extends FileModel $original_filename = e('Screenshot taken %s', $this->helper->dt->datetime(time())).'.png'; return $this->uploadContent($task_id, $original_filename, $blob); } + + /** + * Fire file creation event + * + * @access protected + * @param integer $file_id + */ + protected function fireCreationEvent($file_id) + { + $this->queueManager->push($this->taskFileEventJob->withParams($file_id, self::EVENT_CREATE)); + } } |
