From 9536d3caa8df209193c1d7774fb5638d4aeed215 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Thu, 11 Nov 2021 14:05:47 +0800 Subject: [PATCH 1/2] * Fill in the missing code of action module for MR review. --- module/action/lang/en.php | 6 ++++++ module/action/lang/zh-cn.php | 6 ++++++ module/action/lang/zh-tw.php | 6 ++++++ module/action/model.php | 8 ++++---- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 65c117cd60..3018415276 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -674,3 +674,9 @@ $lang->action->apiTitle->reviewrejected = 'Review rejected'; $lang->action->apiTitle->reviewclarified = 'Review clarified'; $lang->action->apiTitle->commitsummary = 'Commit summary'; $lang->action->apiTitle->updatetrainee = 'Update trainee'; + +/* Code Review in Repo or Merge Request module. */ +$lang->action->desc->repocreated = '$date, created and reviewed by $actor: $extra.' . "\n"; +$lang->action->label->repocreated = "create and review"; +$lang->action->dynamicAction->task['gitcommited'] = 'Git Commit'; +$lang->action->dynamicAction->bug['repocreated'] = $lang->action->label->repocreated; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index b957726aae..56c9ca197b 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -674,3 +674,9 @@ $lang->action->apiTitle->reviewrejected = '拒绝'; $lang->action->apiTitle->reviewclarified = '有待明确'; $lang->action->apiTitle->commitsummary = '提交培训总结'; $lang->action->apiTitle->updatetrainee = '更新培训人员'; + +/* Code Review in Repo or Merge Request module. */ +$lang->action->desc->repocreated = '$date, 由 $actor 评审创建:$extra。' . "\n"; +$lang->action->label->repocreated = "创建评审"; +$lang->action->dynamicAction->task['gitcommited'] = 'git提交'; +$lang->action->dynamicAction->bug['repocreated'] = '创建代码评审'; diff --git a/module/action/lang/zh-tw.php b/module/action/lang/zh-tw.php index 2d10a38721..dcf8b1df2b 100755 --- a/module/action/lang/zh-tw.php +++ b/module/action/lang/zh-tw.php @@ -674,3 +674,9 @@ $lang->action->apiTitle->reviewrejected = '拒絶'; $lang->action->apiTitle->reviewclarified = '有待明確'; $lang->action->apiTitle->commitsummary = '提交培訓總結'; $lang->action->apiTitle->updatetrainee = '更新培訓人員'; + +/* Code Review in Repo or Merge Request module. */ +$lang->action->desc->repocreated = '$date, 由 $actor 評審創建:$extra。' . "\n"; +$lang->action->label->repocreated = "創建評審"; +$lang->action->dynamicAction->task['gitcommited'] = 'git提交'; +$lang->action->dynamicAction->bug['repocreated'] = '創建代碼評審'; diff --git a/module/action/model.php b/module/action/model.php index 7a18b7d1db..6870571cf6 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -635,7 +635,7 @@ class actionModel extends model /** * Print actions of an object. * - * @param array $action + * @param object $action * @param string $desc * @access public * @return void @@ -939,9 +939,9 @@ class actionModel extends model /** * Transform the actions for display. * - * @param int $actions + * @param array $actions * @access public - * @return void + * @return object */ public function transformActions($actions) { @@ -1529,7 +1529,7 @@ class actionModel extends model /** * Print actions of an object for API(JIHU). * - * @param array $action + * @param object $action * @access public * @return void */ From 6ce5b1de33516f1f99a5e505b7c1574e12c72813 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Thu, 11 Nov 2021 17:24:09 +0800 Subject: [PATCH 2/2] * Correct bad code style and resolve others. --- module/mr/control.php | 4 ++-- module/mr/css/common.css | 2 +- module/mr/js/diff.js | 2 +- module/mr/model.php | 12 ++++++------ module/mr/view/create.html.php | 2 +- module/mr/view/view.html.php | 16 ++++++++-------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index 7612e0d71e..a996519dcb 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -365,7 +365,7 @@ class mr extends control /** * Close this MR. * - * @param mixed $MRID + * @param int $MRID * @return void */ public function close($MRID) @@ -377,7 +377,7 @@ class mr extends control /** * Reopen this MR. * - * @param mixed $MRID + * @param int $MRID * @return void */ public function reopen($MRID) diff --git a/module/mr/css/common.css b/module/mr/css/common.css index f53aab533d..a2da70383a 100644 --- a/module/mr/css/common.css +++ b/module/mr/css/common.css @@ -7,7 +7,7 @@ h3 {font-size: 16px;} .revision {font-size: 12px; line-height: 20px; text-align: right; padding-right: 8px;} .directory {background-image:url('theme/default/images/repo/dir.png');} .file {background-image:url('theme/default/images/repo/txt.png');} -//.icon {width: 17px; padding-left: 10px; padding-right: 2px;} +/* .icon {width: 17px; padding-left: 10px; padding-right: 2px;} */ .mini-icon {display: inline-block; height: 16px; width: 16px; background-color: transparent; background-position: 0 0; background-repeat: no-repeat; vertical-align: text-bottom;} .action {float: left;} .input-group select#encrypt {border-left: 0px;} diff --git a/module/mr/js/diff.js b/module/mr/js/diff.js index 1267f00a1d..a076f1628f 100644 --- a/module/mr/js/diff.js +++ b/module/mr/js/diff.js @@ -102,7 +102,7 @@ $(document).ready(function() $bug.data('data', bug); $bug.toggleClass('show', show > 1); if(show > 2) highlight($bug); - + if(bug.comments) { commentCount = bug.comments.length; diff --git a/module/mr/model.php b/module/mr/model.php index 31a63aa442..53964a6be1 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -87,9 +87,9 @@ class mrModel extends model { if (!empty($_POST['compile'])) { - $repoID = $this->post->repo; - $jobID = $this->post->job; - $compileID = $this->post->compile; + $repoID = $this->post->repo; + $jobID = $this->post->job; + $compileID = $this->post->compile; $compileStatus = $this->loadModel('compile')->getByID($this->post->compile)->status; $MR = fixer::input('post') @@ -175,9 +175,9 @@ class mrModel extends model { if (!empty($_POST['compile'])) { - $repoID = $this->post->repo; - $jobID = $this->post->job; - $compileID = $this->post->compile; + $repoID = $this->post->repo; + $jobID = $this->post->job; + $compileID = $this->post->compile; $compileStatus = $this->loadModel('compile')->getByID($this->post->compile)->status; $MR = fixer::input('post') diff --git a/module/mr/view/create.html.php b/module/mr/view/create.html.php index 549e56b64f..f5b656483f 100644 --- a/module/mr/view/create.html.php +++ b/module/mr/view/create.html.php @@ -83,7 +83,7 @@ - goback, '', 'class="btn btn-wide"'); ?> + goback, '', 'class="btn btn-wide"'); ?> diff --git a/module/mr/view/view.html.php b/module/mr/view/view.html.php index 38f66b4021..e4dbf6cee1 100644 --- a/module/mr/view/view.html.php +++ b/module/mr/view/view.html.php @@ -52,20 +52,20 @@ - state == 'opened') : ?> + state == 'opened'): ?>
mr->commandDocument, $httpRepoURL, $MR->sourceBranch, $branchPath, $MR->targetBranch, $branchPath, $MR->targetBranch); ?>
- state == 'opened' and !$rawMR->has_conflicts) echo html::a(inlink('accept', "mr=$MR->id"), ' ' . $lang->mr->acceptMR, '', "id='mergeButton' class='btn'"); ?> - state == 'opened') : ?> + state == 'opened' and !$rawMR->has_conflicts) echo html::a(inlink('accept', "mr=$MR->id"), ' ' . $lang->mr->acceptMR, '', "id='mergeButton' class='btn'"); ?> + state == 'opened'): ?> id&action=approve&onlybody=yes"), ' ' . $lang->mr->approve, '', "id='mergeButton' class='btn iframe showinonlybody'"); ?> id&action=reject&onlybody=yes"), ' ' . $lang->mr->reject, '', "id='mergeButton' class='btn iframe showinonlybody'"); ?> id"), ' ' . $lang->mr->close, '', "id='mergeButton' class='btn'"); ?> id"), ' ' . str_replace($lang->mr->common, '', $lang->mr->edit), '', "id='mergeButton' class='btn'"); ?> - state == 'closed') echo html::a(inlink('reopen', "mr=$MR->id"), ' ' . $lang->mr->reopen, '', "id='mergeButton' class='btn'"); ?> + state == 'closed') echo html::a(inlink('reopen', "mr=$MR->id"), ' ' . $lang->mr->reopen, '', "id='mergeButton' class='btn'"); ?> id"), ' ' . str_replace($lang->mr->common, '', $lang->mr->delete), '', "id='mergeButton' class='btn'"); ?>
@@ -81,7 +81,7 @@ mr->status; ?> mr->statusList, $MR->status); ?>
- head_pipeline->status)) : ?> + head_pipeline->status)): ?>
mr->pipeline}{$lang->mr->status}"; ?> mr->pipelineStatus, $rawMR->head_pipeline->status, $lang->mr->pipelineUnknown); ?> @@ -89,9 +89,9 @@ mr->mergeStatus; ?> changes_count)) : + if(empty($rawMR->changes_count)): echo $lang->mr->noChanges; - else : + else: echo zget($lang->mr->mergeStatusList, $rawMR->merge_status); ?>
mr->MRHasConflicts; ?> @@ -112,7 +112,7 @@ mr->approvalStatus; ?> mr->approvalStatusList, $MR->approvalStatus, $lang->mr->approvalStatusList['notReviewed']); ?>
- approvalStatus != '' and $MR->approvalStatus != 'notReviewed') : ?> + approvalStatus != '' and $MR->approvalStatus != 'notReviewed'): ?> mr->reviewer; ?> approver; ?>