From 7db7bd4635838f17508f4438ea65eb5f5ad8be6e Mon Sep 17 00:00:00 2001 From: Guan Xiying Date: Tue, 6 Jul 2021 10:18:28 +0800 Subject: [PATCH] * Fix parse bug and story object from webhook issue function. --- module/gitlab/model.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 7eea1cc937..11bd3bcabd 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -712,20 +712,24 @@ class gitlabModel extends model * * @param array $labels * @access public - * @return object|false + * @return object */ public function webhookParseObject($labels) { - $object = null; + $object = null; + $objectType = ''; foreach($labels as $label) { - if(preg_match($this->config->gitlab->labelPattern->task, $label->title)) + if(preg_match($this->config->gitlab->labelPattern->story, $label->title)) $objectType = 'story'; + if(preg_match($this->config->gitlab->labelPattern->task, $label->title)) $objectType = 'task'; + if(preg_match($this->config->gitlab->labelPattern->bug, $label->title)) $objectType = 'bug'; + + if($objectType) { list($prefix, $id) = explode('/', $label->title); - $object = new stdclass; - $object->type = 'task'; $object->id = $id; + $object->type = $objectType; } }