From 2ec55cc67b720720ad0bece12a714d8702803713 Mon Sep 17 00:00:00 2001 From: Remigijus Kiminas Date: Sun, 24 Sep 2023 15:38:34 -0400 Subject: [PATCH] Webhoks saving system messages should not update last msg time --- lhc_web/lib/core/lhchat/lhchatworkflow.php | 2 +- .../lhabstract/erlhabstractmodelautoresponder.php | 2 +- .../erlhabstractmodelautoresponderchat.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lhc_web/lib/core/lhchat/lhchatworkflow.php b/lhc_web/lib/core/lhchat/lhchatworkflow.php index 1e9166328b..693138c972 100644 --- a/lhc_web/lib/core/lhchat/lhchatworkflow.php +++ b/lhc_web/lib/core/lhchat/lhchatworkflow.php @@ -19,7 +19,7 @@ public static function timeoutWorkflow(erLhcoreClassModelChat & $chat) $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $chat)); $msg->saveThis(); diff --git a/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponder.php b/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponder.php index b52733f142..29b66b4c62 100644 --- a/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponder.php +++ b/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponder.php @@ -465,7 +465,7 @@ public function getMeta(& $chat, $type, $counter = null, $options = array()) // Dispatch event for a new messages foreach (erLhcoreClassModelmsg::getList(['filtergt' => ['id' => $last_msg_id], 'filter' => ['chat_id' => $chat->id]]) as $newMessage) { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $newMessage, 'chat' => & $chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true, 'msg' => & $newMessage, 'chat' => & $chat)); } } else { diff --git a/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponderchat.php b/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponderchat.php index fa66b4d59c..a503855d91 100644 --- a/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponderchat.php +++ b/lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponderchat.php @@ -149,7 +149,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true, 'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis(); @@ -203,7 +203,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis(); @@ -227,7 +227,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis(); @@ -264,7 +264,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis(); @@ -302,7 +302,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis(); @@ -346,7 +346,7 @@ public function process() $msg->time = time(); \LiveHelperChat\Models\Departments\UserDepAlias::getAlias(array('scope' => 'msg', 'msg' => & $msg, 'chat' => & $this->chat)); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('msg' => & $msg, 'chat' => & $this->chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_msg_saved', array('ignore_times' => true,'msg' => & $msg, 'chat' => & $this->chat)); $msg->saveThis();