From 600ac72829ca93eabfbcacb1997857045cc86394 Mon Sep 17 00:00:00 2001 From: chaideqing Date: Wed, 29 Jun 2022 14:10:00 +0800 Subject: [PATCH 1/5] * 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 2/5] * 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 3/5] * 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 4/5] * 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 83c92086eb2d4de6d7e1d6db76f132a556a9c15a Mon Sep 17 00:00:00 2001 From: chaideqing Date: Wed, 13 Jul 2022 13:54:21 +0800 Subject: [PATCH 5/5] * refactor, code format --- xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php | 8 ++++---- xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php | 8 ++++---- .../extension/xuan/message/ext/lang/zh-cn/xuanxuan.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php index dd942b06ce..8fbd39f334 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/de/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/de/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/lang/en/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php index dd942b06ce..8fbd39f334 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/en/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/en/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/lang/zh-cn/xuanxuan.php b/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php index 1fca470949..7503db0276 100644 --- a/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php +++ b/xuanxuan/extension/xuan/message/ext/lang/zh-cn/xuanxuan.php @@ -3,10 +3,10 @@ $lang->message->typeList['xuanxuan'] = '聊天'; $lang->message->sender = '禅道项目管理'; -$lang->message->notifyTitle = '%s %s%d个%s'; -$lang->message->notifyPassTitle = '%s 通过了%d个研发需求'; -$lang->message->notifyClarifyTitle = '%s 驳回了%d个研发需求'; -$lang->message->notifyRejectTitle = '%s 拒绝了%d个研发需求'; +$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 = '构建日志';