From ccf132cc87575a237009e81f993bda4750f36a01 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 22 Jun 2021 11:47:24 +0800 Subject: [PATCH 1/2] * Add more issue params. --- module/gitlab/model.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 7c51dc2f50..86c757c9a9 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -536,9 +536,21 @@ class gitlabModel extends model $request = new stdclass; $request->type = $body->object_kind; $issue = $body->object_attributes; + + $request->labels = $labels; + $request->type = $labelType; + $request->typeID = $labelTypeID; + + $request->project = $body->project->id; + $request->title = $issue->title; + $request->description = $issue->description; + $request->action = $issue->action; + $request->created_at = $issue->created_at; + $request->due_date = $issue->due_date; - $request->labels = $body->labels; - $request->project = $body->project->id; + $request->assignees = $issue->assignee_id; + $request->url = $issue->url; + a($request);exit(); } } From 3e18bc7e1955bbfd977a1ab8c576dd317bd086ed Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 22 Jun 2021 12:17:19 +0800 Subject: [PATCH 2/2] + Add story label func. --- module/gitlab/config.php | 12 +++++++++--- module/gitlab/model.php | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/module/gitlab/config.php b/module/gitlab/config.php index a4bff19207..86296f77f6 100644 --- a/module/gitlab/config.php +++ b/module/gitlab/config.php @@ -7,17 +7,23 @@ $config->gitlab->edit->requiredFields = 'name,url,token'; $config->gitlab->taskLabel = new stdclass(); $config->gitlab->taskLabel->name = "zentao task"; -$config->gitlab->taskLabel->description = "task label from zentao"; +$config->gitlab->taskLabel->description = "task label from zentao, do NOT remove this"; $config->gitlab->taskLabel->color = "#0033CC"; $config->gitlab->taskLabel->priority = "0"; $config->gitlab->bugLabel = new stdclass(); $config->gitlab->bugLabel->name = "zentao bug"; -$config->gitlab->bugLabel->description = "bug label from zentao"; +$config->gitlab->bugLabel->description = "bug label from zentao, do NOT remove this"; $config->gitlab->bugLabel->color = "#D10069"; $config->gitlab->bugLabel->priority = "0"; -$config->gitlab->zentaoApiWebhookUrl = "%s/api.php?m=gitlab&f=webhook&product=%s&gitlab=%s"; +$config->gitlab->storyLabel = new stdclass(); +$config->gitlab->storyLabel->name = "zentao story"; +$config->gitlab->storyLabel->description = "story label from zentao, do NOT remove this"; +$config->gitlab->storyLabel->color = "##69D100"; +$config->gitlab->storyLabel->priority = "0"; + +config->gitlab->zentaoApiWebhookUrl = "%s/api.php?m=gitlab&f=webhook&product=%s&gitlab=%s"; $config->gitlab->zentaoApiWebhookToken = ""; diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 86c757c9a9..b167d485fb 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -466,6 +466,7 @@ class gitlabModel extends model { if(strpos($label->name, $this->config->gitlab->taskLabel->name) == 0) return true; if(strpos($label->name, $this->config->gitlab->bugLabel->name) == 0) return true; + if(strpos($label->name, $this->config->gitlab->storyLabel->name) == 0) return true; } return false; @@ -494,9 +495,16 @@ class gitlabModel extends model $bugLabel->description = $this->config->gitlab->bugLabel->description; $bugLabel->color = $this->config->gitlab->bugLabel->color; $bugLabel->priority = $this->config->gitlab->bugLabel->priority; + + $storyLabel = new stdclass(); + $storyLabel->name = $this->config->gitlab->storyLabel->name; + $storyLabel->description = $this->config->gitlab->storyLabel->description; + $storyLabel->color = $this->config->gitlab->storyLabel->color; + $storyLabel->priority = $this->config->gitlab->storyLabel->priority; $this->apiCreateLabel($gitlabID, $projectID, $taskLabel); $this->apiCreateLabel($gitlabID, $projectID, $bugLabel); + $this->apiCreateLabel($gitlabID, $projectID, $storyLabel); return; }