Skip to content

Commit

Permalink
tweak(Felamimail) AttachmentCache creates previews on request if not …
Browse files Browse the repository at this point in the history
…yet created
  • Loading branch information
paulmhh committed Mar 15, 2024
1 parent 38a309f commit ecd7d8c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tine20/Felamimail/Controller/AttachmentCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ public function get($_id, $_containerId = null, $_getRelatedData = true, $_getDe
);
$this->getBackend()->update($record);

if (Tinebase_FileSystem::getInstance()->_getTreeNodeBackend()->doSynchronousPreviewCreation()) {
/** @var Tinebase_Model_Tree_Node $node */
if (0 === ($node = $record->attachments?->getFirstRecord())?->preview_count && Tinebase_FileSystem_Previews::getInstance()->canNodeHavePreviews($node) &&
Tinebase_FileSystem_Previews::getInstance()->createPreviewsFromNode($node)) {
$record->attachments->removeRecord($node);
$record->attachments->addRecord(Tinebase_FileSystem::getInstance()->get($node->getId()));
}
}

return $record;
} catch (Tinebase_Exception $te) {
unset($selectForUpdate);
Expand Down

0 comments on commit ecd7d8c

Please sign in to comment.