From 600ac72829ca93eabfbcacb1997857045cc86394 Mon Sep 17 00:00:00 2001 From: chaideqing Date: Wed, 29 Jun 2022 14:10:00 +0800 Subject: [PATCH 01/16] * modify notify style, task #58690 --- .../xuan/im/ext/model/class/xuanxuan.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php b/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php index f134a049b4..de1634d86f 100644 --- a/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php @@ -225,25 +225,24 @@ class xuanxuanIm extends imModel $notificationContent = json_decode($notification->content); $notificationInnerContent = json_decode($notificationContent->content); - /* Inner content: array($parentID => array($content1, $content2)) */ - $objectGroups = array($notificationInnerContent->parent => array($notificationInnerContent)); + /* Inner content: array($id => array($content1, $content2)) */ + $objectGroups = array($notificationInnerContent->id => array($notificationInnerContent)); foreach($messages as $message) { $messageContent = json_decode($message->content); $messageInnerContent = json_decode($messageContent->content); - $objectGroups[$messageInnerContent->parent][] = $messageInnerContent; + $objectGroups[$messageInnerContent->id][] = $messageInnerContent; } - $objectTotal = 0; - foreach($objectGroups as $parent => $objectGroup) + foreach($objectGroups as $id => $objectGroup) { $object = current($objectGroup); $object->count = count($objectGroup); $object->url = $object->parentURL; unset($object->title); - $objectGroups[$parent] = $object; - $objectTotal += $object->count; + $objectGroups[$id] = $object; } + $objectTotal = count($objectGroups); $notificationContent->content = json_encode(array_values($objectGroups)); /* Hack alert: title count replacement currently assumes that default count is 1. */ $notification->title = substr_replace($notification->title, "$objectTotal", strrpos($notification->title, '1'), 1); From d01dd34431bc88fd5e3d2bc132503a35427c022e Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Thu, 30 Jun 2022 01:47:45 +0000 Subject: [PATCH 02/16] * electron/zentao: fix confirm. --- lib/base/front/front.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index 4c18838dfb..dd21318281 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -968,8 +968,9 @@ class baseJS { $cancleAction = "$cancleTarget.location = '$cancleURL';"; } - - $js .= << Date: Fri, 1 Jul 2022 16:27:40 +0800 Subject: [PATCH 03/16] * adjust xuanxuan notification center logic, task #58691 --- module/action/model.php | 2 +- module/message/model.php | 4 +++- .../im/ext/model/class/xuanxuan.class.php | 14 ++++++++++--- .../xuan/message/ext/lang/de/xuanxuan.php | 5 ++++- .../xuan/message/ext/lang/en/xuanxuan.php | 5 ++++- .../xuan/message/ext/lang/fr/xuanxuan.php | 5 ++++- .../xuan/message/ext/lang/zh-cn/xuanxuan.php | 5 ++++- .../ext/model/class/xuanxuan.class.php | 21 +++++++++++++++++-- .../message/ext/model/hook/send.xuanxuan.php | 2 +- 9 files changed, 51 insertions(+), 12 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 3df166a917..89016a1ca3 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -73,7 +73,7 @@ class actionModel extends model if($this->post->uid) $this->file->updateObjectID($this->post->uid, $objectID, $objectType); /* Call the message notification function. */ - $this->loadModel('message')->send(strtolower($objectType), $objectID, $actionType, $actionID, $actor); + $this->loadModel('message')->send(strtolower($objectType), $objectID, $actionType, $actionID, $actor, $extra); /* Add index for global search. */ $this->saveIndex($objectType, $objectID, $actionType); diff --git a/module/message/model.php b/module/message/model.php index a5f2cccd7f..b640916bc4 100755 --- a/module/message/model.php +++ b/module/message/model.php @@ -59,10 +59,12 @@ class messageModel extends model * @param int $objectID * @param string $actionType * @param int $actionID + * @param string $actor + * @param string $extra * @access public * @return void */ - public function send($objectType, $objectID, $actionType, $actionID, $actor = '') + public function send($objectType, $objectID, $actionType, $actionID, $actor = '', $extra = '') { $objectType = strtolower($objectType); $messageSetting = $this->config->message->setting; diff --git a/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php b/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php index de1634d86f..8391277656 100644 --- a/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/extension/xuan/im/ext/model/class/xuanxuan.class.php @@ -207,14 +207,22 @@ class xuanxuanIm extends imModel foreach($userMessages as $message) { /* Group by $message->content->content->objectType, ...->parentType, ...->action, ...->actor */ - $contentData = json_decode($message->content); - $contentData = json_decode($contentData->content); + $contentDataOuter = json_decode($message->content); + $contentData = json_decode($contentDataOuter->content); if(isset($contentData->contentType) && $contentData->contentType == 'text') { $messageGroups[$contentData->contentType][] = $message; continue; } - $messageGroups["$contentData->objectType-$contentData->parentType-$contentData->action-$contentData->actor"][] = $message; + if ($contentData->objectType == 'story' && $contentData->action == 'reviewed') + { + $extra = explode(',', $contentDataOuter->extra)[0]; + $messageGroups["$contentData->objectType-$contentData->parentType-$contentData->action-$contentData->actor-$extra"][] = $message; + } + else + { + $messageGroups["$contentData->objectType-$contentData->parentType-$contentData->action-$contentData->actor"][] = $message; + } } foreach($messageGroups as $groupKey => $messages) { diff --git a/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php index 7fbcf17e93..dd942b06ce 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php @@ -3,7 +3,10 @@ $lang->message->typeList['xuanxuan'] = 'Chat'; $lang->message->sender = 'ZenTao'; -$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyPassTitle = '%s passed %d stories'; +$lang->message->notifyClarifyTitle = '%s clarify %d stories'; +$lang->message->notifyRejectTitle = '%s reject %d stories'; $lang->message->mr = new stdClass(); $lang->message->mr->logTitle = 'Build log'; diff --git a/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php index 7fbcf17e93..dd942b06ce 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php @@ -3,7 +3,10 @@ $lang->message->typeList['xuanxuan'] = 'Chat'; $lang->message->sender = 'ZenTao'; -$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyPassTitle = '%s passed %d stories'; +$lang->message->notifyClarifyTitle = '%s clarify %d stories'; +$lang->message->notifyRejectTitle = '%s reject %d stories'; $lang->message->mr = new stdClass(); $lang->message->mr->logTitle = 'Build log'; diff --git a/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php index 7fbcf17e93..dd942b06ce 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php @@ -3,7 +3,10 @@ $lang->message->typeList['xuanxuan'] = 'Chat'; $lang->message->sender = 'ZenTao'; -$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyPassTitle = '%s passed %d stories'; +$lang->message->notifyClarifyTitle = '%s clarify %d stories'; +$lang->message->notifyRejectTitle = '%s reject %d stories'; $lang->message->mr = new stdClass(); $lang->message->mr->logTitle = 'Build log'; diff --git a/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php index 32599f2ce7..1fca470949 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php @@ -3,7 +3,10 @@ $lang->message->typeList['xuanxuan'] = '聊天'; $lang->message->sender = '禅道项目管理'; -$lang->message->notifyTitle = '%s %s%d个%s'; +$lang->message->notifyTitle = '%s %s%d个%s'; +$lang->message->notifyPassTitle = '%s 通过了%d个研发需求'; +$lang->message->notifyClarifyTitle = '%s 驳回了%d个研发需求'; +$lang->message->notifyRejectTitle = '%s 拒绝了%d个研发需求'; $lang->message->mr = new stdClass(); $lang->message->mr->logTitle = '构建日志'; diff --git a/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php b/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php index ad3d677375..2c34039c6a 100644 --- a/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php @@ -1,7 +1,7 @@ config->message->setting; if(is_string($messageSetting)) $messageSetting = json_decode($messageSetting, true); @@ -44,6 +44,22 @@ class xuanxuanMessage extends messageModel ->fetch(); $field = $this->config->action->objectNameFields[$objectType]; $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyTitle, $this->app->user->realname, $this->lang->action->label->$actionType, 1, $this->lang->action->objectTypes[$objectType]); + if ($objectType == 'story' && $actionType == 'reviewed' && !empty($extra)) + { + $notifyType = strtolower(explode(',', $extra)[0]); + if ($notifyType == 'pass') + { + $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyPassTitle, $this->app->user->realname, 1); + } + if ($notifyType == 'clarify') + { + $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyClarifyTitle, $this->app->user->realname, 1); + } + if ($notifyType == 'reject') + { + $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyRejectTitle, $this->app->user->realname, 1); + } + } $server = $this->loadModel('im')->getServer('zentao'); $onlybody = isset($_GET['onlybody']) ? $_GET['onlybody'] : ''; @@ -52,7 +68,7 @@ class xuanxuanMessage extends messageModel $url = $server . helper::createLink($objectType == 'kanbancard' ? 'kanban' : $objectType, 'view', "id=$dataID", 'html'); $target = ''; - if(!empty($object->assignedTo)) $target .= $object->assignedTo; + if(!empty($object->assignedTo)) $target .= $object->assignedTo == 'closed' ? $object->openedBy : $object->assignedTo; if(!empty($object->mailto)) $target .= ",{$object->mailto}"; if(($objectType == 'mr' or $objectType == 'kanbancard') and !empty($object->createdBy)) $target .= ",{$object->createdBy}"; $target = trim($target, ','); @@ -130,6 +146,7 @@ class xuanxuanMessage extends messageModel $contentData->actions = array(); $contentData->url = "xxc:openInApp/zentao-integrated/" . urlencode($url); } + $contentData->extra = $extra; $content = json_encode($contentData); $avatarUrl = $server . $this->app->getWebRoot() . 'favicon.ico'; diff --git a/xuanxuan/extension/xuan/message/ext/model/hook/send.xuanxuan.php b/xuanxuan/extension/xuan/message/ext/model/hook/send.xuanxuan.php index 23d82e1381..ef1529ceaa 100644 --- a/xuanxuan/extension/xuan/message/ext/model/hook/send.xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/model/hook/send.xuanxuan.php @@ -1,2 +1,2 @@ loadExtension('xuanxuan')->send($objectType, $objectID, $actionType, $actionID, $actor); +$this->loadExtension('xuanxuan')->send($objectType, $objectID, $actionType, $actionID, $actor, $extra); From c5ee9f589c175074ea31818a51ae388f18ccacb8 Mon Sep 17 00:00:00 2001 From: chaideqing Date: Mon, 11 Jul 2022 17:16:17 +0800 Subject: [PATCH 04/16] * refactor code --- xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php | 8 ++++---- .../xuan/message/ext/model/class/xuanxuan.class.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php index dd942b06ce..8fbd39f334 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/fr/xuanxuan.php @@ -3,10 +3,10 @@ $lang->message->typeList['xuanxuan'] = 'Chat'; $lang->message->sender = 'ZenTao'; -$lang->message->notifyTitle = '%s %s%d %s'; -$lang->message->notifyPassTitle = '%s passed %d stories'; -$lang->message->notifyClarifyTitle = '%s clarify %d stories'; -$lang->message->notifyRejectTitle = '%s reject %d stories'; +$lang->message->notifyTitle = '%s %s%d %s'; +$lang->message->notifyPassTitle = '%s passed %d stories'; +$lang->message->notifyClarifyTitle = '%s clarify %d stories'; +$lang->message->notifyRejectTitle = '%s reject %d stories'; $lang->message->mr = new stdClass(); $lang->message->mr->logTitle = 'Build log'; diff --git a/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php b/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php index 2c34039c6a..5ec9449fb8 100644 --- a/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/extension/xuan/message/ext/model/class/xuanxuan.class.php @@ -51,11 +51,11 @@ class xuanxuanMessage extends messageModel { $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyPassTitle, $this->app->user->realname, 1); } - if ($notifyType == 'clarify') + else if($notifyType == 'clarify') { $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyClarifyTitle, $this->app->user->realname, 1); } - if ($notifyType == 'reject') + else if($notifyType == 'reject') { $title = $objectType == 'mr' ? '' : sprintf($this->lang->message->notifyRejectTitle, $this->app->user->realname, 1); } From 090989e25eb21af470d807cae568a622931c48c5 Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 13 Jul 2022 11:11:36 +0800 Subject: [PATCH 05/16] * Fix bug #24404. --- module/task/js/create.js | 2 +- module/task/view/create.html.php | 3 +-- module/tree/control.php | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/task/js/create.js b/module/task/js/create.js index f35f137c43..08ad7b1547 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -274,7 +274,7 @@ function setLane(regionID) } /* Get select of stories.*/ -function setStories(moduleID) +function setStories(moduleID, executionID) { link = createLink('story', 'ajaxGetExecutionStories', 'executionID=' + executionID + '&productID=0&branch=all&moduleID=' + moduleID + '&storyID=0&number=&type=full&status=unclosed'); $.get(link, function(stories) diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index 2945a31283..ff4ce54b29 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -13,7 +13,6 @@ -id);?> id));?> task->error->teamMember);?> @@ -60,7 +59,7 @@ foreach(explode(',', $config->task->create->requiredFields) as $field) task->module;?> - module, "class='form-control chosen' onchange='setStories(this.value)'");?> + module, "class='form-control chosen' onchange='setStories(this.value, $execution->id)'");?>
> diff --git a/module/tree/control.php b/module/tree/control.php index 148073abad..2255856940 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -517,7 +517,7 @@ class tree extends control { $changeFunc = ''; if($viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'"; - if($viewType == 'task') $changeFunc = "onchange='setStories(this.value)'"; + if($viewType == 'task') $changeFunc = "onchange='setStories(this.value, $rootID)'"; $field = $fieldID ? "modules[$fieldID]" : 'module'; $currentModule = $this->tree->getById($currentModuleID); @@ -539,7 +539,8 @@ class tree extends control if($returnType == 'mhtml') { $changeFunc = ''; - if($viewType == 'task' or $viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'"; + if($viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'"; + if($viewType == 'task') $changeFunc = "onchange='setStories(this.value, $rootID)'"; $field = $fieldID ? "modules[$fieldID]" : 'module'; $output = html::select("$field", $optionMenu, '', "class='input' $changeFunc"); die($output); From 3cfa290a92f2ad97d46ec8247e81641fe72c9aea Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 13 Jul 2022 11:31:57 +0800 Subject: [PATCH 06/16] * Fix bug #24404. --- module/task/js/create.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/module/task/js/create.js b/module/task/js/create.js index 08ad7b1547..fa6378c063 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -127,7 +127,8 @@ function loadExecutionStories(executionID) */ function loadModuleMenu(executionID) { - var link = createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + executionID + '&viewtype=task'); + var extra = $('#showAllModule').prop('checked') ? 'allModule' : ''; + var link = createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + executionID + '&viewtype=task&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=0&extra=' + extra); $('#moduleIdBox').load(link, function(){$('#module').chosen();}); } @@ -501,11 +502,12 @@ $(document).ready(function() $('#showAllModule').change(function() { - var moduleID = $('#moduleIdBox #module').val(); - var extra = $(this).prop('checked') ? 'allModule' : ''; + var executionID = $('#execution').val(); + var moduleID = $('#moduleIdBox #module').val(); + var extra = $(this).prop('checked') ? 'allModule' : ''; $('#moduleIdBox').load(createLink('tree', 'ajaxGetOptionMenu', "rootID=" + executionID + '&viewType=task&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=0&extra=' + extra), function() { - $('#moduleIdBox #module').val(moduleID).chosen(); + $('#module').val(moduleID).chosen(); }); }); }); From cc31e0efa0e1514de4307e31a1c79d18b4d59313 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 13 Jul 2022 13:09:30 +0800 Subject: [PATCH 07/16] * Fix bug #24491. --- module/testcase/view/browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 87d95d09e1..80068e2523 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -261,7 +261,7 @@ js::set('suiteID', $suiteID);