diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Integration/GithubWebhook.php | 14 | ||||
-rw-r--r-- | app/Integration/GitlabWebhook.php | 2 | ||||
-rw-r--r-- | app/Model/TaskFinder.php | 5 |
3 files changed, 11 insertions, 10 deletions
diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php index 121fdd1b..0070c309 100644 --- a/app/Integration/GithubWebhook.php +++ b/app/Integration/GithubWebhook.php @@ -139,7 +139,7 @@ class GithubWebhook extends Base */ public function parseCommentIssueEvent(array $payload) { - $task = $this->taskFinder->getByReference($payload['issue']['number']); + $task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['number']); $user = $this->user->getByUsername($payload['comment']['user']['login']); if (! empty($task) && ! empty($user)) { @@ -196,7 +196,7 @@ class GithubWebhook extends Base */ public function handleIssueClosed(array $issue) { - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($task)) { $event = array( @@ -225,7 +225,7 @@ class GithubWebhook extends Base */ public function handleIssueReopened(array $issue) { - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($task)) { $event = array( @@ -255,7 +255,7 @@ class GithubWebhook extends Base public function handleIssueAssigned(array $issue) { $user = $this->user->getByUsername($issue['assignee']['login']); - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($user) && ! empty($task)) { @@ -286,7 +286,7 @@ class GithubWebhook extends Base */ public function handleIssueUnassigned(array $issue) { - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($task)) { @@ -318,7 +318,7 @@ class GithubWebhook extends Base */ public function handleIssueLabeled(array $issue, array $label) { - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($task)) { @@ -350,7 +350,7 @@ class GithubWebhook extends Base */ public function handleIssueUnlabeled(array $issue, array $label) { - $task = $this->taskFinder->getByReference($issue['number']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); if (! empty($task)) { diff --git a/app/Integration/GitlabWebhook.php b/app/Integration/GitlabWebhook.php index dbba3663..e30a0b50 100644 --- a/app/Integration/GitlabWebhook.php +++ b/app/Integration/GitlabWebhook.php @@ -191,7 +191,7 @@ class GitlabWebhook extends Base */ public function handleIssueClosed(array $issue) { - $task = $this->taskFinder->getByReference($issue['id']); + $task = $this->taskFinder->getByReference($this->project_id, $issue['id']); if (! empty($task)) { $event = array( diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php index 7216e92a..54dd578a 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinder.php @@ -204,12 +204,13 @@ class TaskFinder extends Base * Fetch a task by the reference (external id) * * @access public + * @param integer $project_id Project id * @param string $reference Task reference * @return array */ - public function getByReference($reference) + public function getByReference($project_id, $reference) { - return $this->db->table(Task::TABLE)->eq('reference', $reference)->findOne(); + return $this->db->table(Task::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne(); } /** |