Merge pull request #765 from guillegiu/correct_displaying_of_email_images

fix image displaying
This commit is contained in:
Guillermo Giuliana 2020-04-16 13:59:31 -03:00 committed by GitHub
commit 50f5dd24b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -38,6 +38,7 @@ class CommentController extends Controller {
private $ticket;
private $content;
private $session;
private $imagePaths;
public function validations() {
$this->session = Session::getInstance();
@ -119,12 +120,11 @@ class CommentController extends Controller {
private function storeComment() {
$fileUploader = FileUploader::getInstance();
$fileUploader->setPermission(FileManager::PERMISSION_TICKET, $this->ticket->ticketNumber);
$imagePaths = $this->uploadImages(Controller::isStaffLogged());
$fileUploader = $this->uploadFile(Controller::isStaffLogged());
$comment = Ticketevent::getEvent(Ticketevent::COMMENT);
$comment->setProperties(array(
'content' => $this->replaceWithImagePaths($imagePaths, $this->content),
'content' => $this->replaceWithImagePaths($this->getImagePaths(), $this->content),
'file' => ($fileUploader instanceof FileUploader) ? $fileUploader->getFileName() : null,
'date' => Date::getCurrentDate(),
'private' => (Controller::isStaffLogged() && Controller::request('private')) ? 1 : 0
@ -164,10 +164,18 @@ class CommentController extends Controller {
'name' => $name,
'title' => $this->ticket->title,
'ticketNumber' => $this->ticket->ticketNumber,
'content' => $this->content,
'content' => $this->replaceWithImagePaths($this->getImagePaths(), $this->content),
'url' => $url
]);
$mailSender->send();
}
private function getImagePaths() {
if(!$this->imagePaths){
$this->imagePaths = $this->uploadImages(Controller::isStaffLogged());
}
return $this->imagePaths;
}
}