Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Felamimail/message): show original received date
Browse files Browse the repository at this point in the history
Change-Id: Icd618017a755855b7785eaac64a669147f226e1b
Reviewed-on: http://gerrit.tine20.com/customers/18489
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
  • Loading branch information
ccheng-dev authored and pschuele committed Nov 24, 2020
1 parent 61cf103 commit 0227da5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/tine20/Felamimail/Frontend/JsonTest.php
Expand Up @@ -886,7 +886,8 @@ public function testMoveMessage($moveToFolderName = null)
$this->assertEquals($inboxBefore['cache_unreadcount'], $inboxAfter['cache_unreadcount']);
$this->assertEquals($inboxBefore['cache_totalcount'], $inboxAfter['cache_totalcount']);

$this->_assertMessageInFolder($moveToFolderName, $message['subject']);
$movedMessage = $this->_assertMessageInFolder($moveToFolderName, $message['subject']);
self::assertEquals($message['received'], $movedMessage['received'], 'received date different');
}

protected function _moveMessageToFolder($moveToFolderName, $keepOriginalMessages = false, $account = null)
Expand Down
8 changes: 8 additions & 0 deletions tine20/Felamimail/Controller/Cache/Message.php
Expand Up @@ -768,6 +768,8 @@ protected function _fetchAndAddMessages(Felamimail_Model_Folder $_folder, Felami

try {
$messages = $_imap->getSummary($messageSequenceStart, $messageSequenceEnd, false);


} catch (Zend_Mail_Protocol_Exception $zmpe) {
// imap server might have gone away during update
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
Expand Down Expand Up @@ -801,6 +803,12 @@ protected function _addMessagesToCacheAndIncreaseCounters($_messages, $_folder)
. ' ' . print_r($message, TRUE));

$transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());

if (array_key_exists('header', $message) && array_key_exists('received', $message['header'])) {
$received = explode(';', $message['header']['received'][0]);
$message['received'] = isset($received[1]) ? date("d-M-Y H:i:s O", strtotime($received[1])) : $message['received'];
}

try {
if ($this->addMessage($message, $_folder)) {
$_folder->cache_job_actions_done++;
Expand Down

0 comments on commit 0227da5

Please sign in to comment.