diff --git a/assets/vue/views/message/MessageList.vue b/assets/vue/views/message/MessageList.vue index 297c3a2a3d..f3e0a0c692 100644 --- a/assets/vue/views/message/MessageList.vue +++ b/assets/vue/views/message/MessageList.vue @@ -429,7 +429,7 @@ function sortingChanged(event) { } function findMyReceiver(message) { - const receivers = [...message.receiversTo, ...message.receiversCc] + const receivers = [...message.receiversTo, ...message.receiversCc, ...message.receiversSender] return receivers.find(({ receiver }) => receiver["@id"] === securityStore.user["@id"]) } diff --git a/assets/vue/views/message/MessageShow.vue b/assets/vue/views/message/MessageShow.vue index 594057d9c0..342c0a168a 100644 --- a/assets/vue/views/message/MessageShow.vue +++ b/assets/vue/views/message/MessageShow.vue @@ -188,7 +188,7 @@ store.dispatch("message/load", id).then((responseItem) => { }) function findMyReceiver(message) { - const receivers = [...message.receiversTo, ...message.receiversCc] + const receivers = [...message.receiversTo, ...message.receiversCc, ...message.receiversSender] return receivers.find(({ receiver }) => receiver["@id"] === securityStore.user["@id"]) } diff --git a/src/CoreBundle/Entity/Message.php b/src/CoreBundle/Entity/Message.php index ca7b8d0240..6eaf7b4551 100644 --- a/src/CoreBundle/Entity/Message.php +++ b/src/CoreBundle/Entity/Message.php @@ -222,6 +222,17 @@ class Message ; } + #[Groups(['message:read'])] + public function getReceiversSender(): array + { + return $this->receivers + ->filter( + fn (MessageRelUser $messageRelUser) => MessageRelUser::TYPE_SENDER === $messageRelUser->getReceiverType() + ) + ->getValues() + ; + } + #[Groups(['message:read'])] public function getFirstReceiver(): ?MessageRelUser { diff --git a/src/CoreBundle/State/MessageProcessor.php b/src/CoreBundle/State/MessageProcessor.php index 9efb64434f..1d6547a410 100644 --- a/src/CoreBundle/State/MessageProcessor.php +++ b/src/CoreBundle/State/MessageProcessor.php @@ -82,36 +82,6 @@ final class MessageProcessor implements ProcessorInterface return $message; } - private function processDeleteForUser($data): Message - { - /** @var Message $message */ - $message = $data; - - $request = $this->requestStack->getCurrentRequest(); - if (!$request) { - throw new LogicException('Cannot get current request'); - } - - $requestData = json_decode($request->getContent(), true); - if (!isset($requestData['userId'])) { - throw new InvalidArgumentException('The field userId is required.'); - } - - $userId = $requestData['userId']; - $messageRelUserRepository = $this->entityManager->getRepository(MessageRelUser::class); - $messageRelUser = $messageRelUserRepository->findOneBy([ - 'message' => $message, - 'receiver' => $userId, - ]); - - if ($messageRelUser) { - $this->entityManager->remove($messageRelUser); - $this->entityManager->flush(); - } - - return $message; - } - private function saveNotificationForInboxMessage(Message $message): void { $sender_info = api_get_user_info(