Add null check for roomToken before processing attachments in GestionService

This commit is contained in:
Tiavina 2025-03-25 17:38:47 +03:00
parent 72417d3d94
commit 1acf4610d7
2 changed files with 18 additions and 14 deletions

View File

@ -249,12 +249,14 @@ class GestionService {
}
}else {
$roomToken = $this->talkService->getRoomTokenBeetwenTwoUser($this->userConnectedUuid, $userName);
foreach ( $attachments as $attachment) {
$this->userConnectedStorage->getFullPath("/");
$path = Filesystem::getPath($attachment['file_id']);
$destination = 'Talk/';
Filesystem::copy($path, $destination . $attachment['name']);
$this->sendFileAttachmentToTalk($roomToken,$cookie , $attachment['name']);
if($roomToken != null){
foreach ( $attachments as $attachment) {
$this->userConnectedStorage->getFullPath("/");
$path = Filesystem::getPath($attachment['file_id']);
$destination = 'Talk/';
Filesystem::copy($path, $destination . $attachment['name']);
$this->sendFileAttachmentToTalk($roomToken,$cookie , $attachment['name']);
}
}
}
@ -408,13 +410,15 @@ class GestionService {
}else{
$roomToken = $this->talkService->getRoomTokenBeetwenTwoUser($this->userConnectedUuid, $userName);
foreach ( $attachments as $attachment) {
$this->userConnectedStorage->getFullPath("/");
$path = Filesystem::getPath($attachment['file_id']);
$destination = 'Talk/';
Filesystem::copy($path, $destination . $attachment['name']);
//sendFileAttachmentToTalk
$this->sendFileAttachmentToTalk($roomToken,$cookie , $attachment['name']);
if($roomToken != null){
foreach ( $attachments as $attachment) {
$this->userConnectedStorage->getFullPath("/");
$path = Filesystem::getPath($attachment['file_id']);
$destination = 'Talk/';
Filesystem::copy($path, $destination . $attachment['name']);
//sendFileAttachmentToTalk
$this->sendFileAttachmentToTalk($roomToken,$cookie , $attachment['name']);
}
}
}

View File

@ -107,7 +107,7 @@ class TalkService {
$senderAndTargetIsTheSameUser = $targetUser == $senderUser;
$senderUser = $senderAndTargetIsTheSameUser ? BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD : $senderUser;
if( $targetUser === BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD && $senderUser === BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD){
return;
return null;
}
$roomNames = $this->getUserDevisTalkRoomNames($targetUser , $senderUser);
$room = $this->talkDb->getDevisTalkRoomByNames($roomNames);