-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:freescout-helpdesk/freescout into…
… dist
- Loading branch information
Showing
25 changed files
with
336 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -605,7 +605,7 @@ public function processMessage($message, $message_id, $mailbox, $mailboxes, $ext | |
$body = $message->getTextBody() ?? ''; | ||
$body = htmlspecialchars($body); | ||
} | ||
$body = $this->separateReply($body, $is_html, $is_reply, !$message_from_customer); | ||
$body = $this->separateReply($body, $is_html, $is_reply, !$message_from_customer, ($message_from_customer ? $prev_thread->getMessageId($mailbox) : '')); | ||
|
||
// We have to fetch absolutely all emails, even with empty body. | ||
// if (!$body) { | ||
|
@@ -1238,7 +1238,7 @@ public function processAttachmentName($name) | |
* | ||
* @return string | ||
*/ | ||
public function separateReply($body, $is_html, $is_reply, $user_reply_to_notification = false) | ||
public function separateReply($body, $is_html, $is_reply, $user_reply_to_notification = false, $prev_message_id = '') | ||
{ | ||
$cmp_reply_length_desc = function ($a, $b) { | ||
if (mb_strlen($a) == mb_strlen($b)) { | ||
|
@@ -1301,6 +1301,18 @@ public function separateReply($body, $is_html, $is_reply, $user_reply_to_notific | |
$reply_separators = [\MailHelper::REPLY_SEPARATOR_NOTIFICATION]; | ||
} | ||
|
||
// Try to separate customer reply using hashed reply separator. | ||
// In this case some extra text may appear below customer's reply: | ||
// On Thu, Jan 4, 2024 at 8:41 AM John Doe | Demo <[email protected]> wrote: | ||
if (config('app.alternative_reply_separation')) { | ||
if (!$user_reply_to_notification && $prev_message_id) { | ||
$hashed_reply_separator = \MailHelper::getHashedReplySeparator($prev_message_id); | ||
if (strstr($result, $hashed_reply_separator)) { | ||
$reply_separators = [$hashed_reply_separator]; | ||
} | ||
} | ||
} | ||
|
||
foreach ($reply_separators as $reply_separator) { | ||
if (\Str::startsWith($reply_separator, 'regex:')) { | ||
$regex = preg_replace("/^regex:/", '', $reply_separator); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.