From e6799383792bf059ae373c27f8321dee5d0303d2 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Wed, 1 Sep 2021 10:29:03 +0800 Subject: [PATCH] * Update ajaxGetMRUserPairs function. --- module/gitlab/control.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 7646ce74b2..dd06f754eb 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -417,16 +417,25 @@ class gitlab extends control /** * AJAX: Get MR user pairs to select assignee_ids and reviewer_ids. + * Attention: The user must be a member of the GitLab project. * * @param int $gitlabID + * @param int $projectID * @access public * @return void */ - public function ajaxGetMRUserPairs($gitlabID) + public function ajaxGetMRUserPairs($gitlabID, $projectID) { if(!$gitlabID) return $this->send(array('message' => array())); - $users = $this->gitlab->getUserIdRealnamePairs($gitlabID); + $bindedUsers = $this->gitlab->getUserIdRealnamePairs($gitlabID); + $rawProjectUsers = $this->gitlab->apiGetProjectUsers($gitlabID, $projectID); + $users = array(); + foreach($rawProjectUsers as $rawProjectUser) + { + if(!empty($bindedUsers[$rawProjectUser->id])) $users[$rawProjectUser->id] = $bindedUsers[$rawProjectUser->id]; + } + $options = ""; foreach($users as $index => $user) {