diff options
author | Joas Schilling <coding@schilljs.com> | 2021-01-15 11:45:21 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-02-02 15:52:24 +0300 |
commit | 9608867be3d01a9aa34aceb1a1ba454fc2e0f8b6 (patch) | |
tree | c66bdbf3595d78fb12a4fad7a657e1dbc5d60096 /lib/Controller/ChatController.php | |
parent | 3d273aa6e8e18d4b096e74221eaf52b30b49e366 (diff) |
Post a system message when deleting a message
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/ChatController.php')
-rw-r--r-- | lib/Controller/ChatController.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 3516388da..bc0dcb277 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -484,16 +484,25 @@ class ChatController extends AEnvironmentAwareController { return new DataResponse([], Http::STATUS_FORBIDDEN); } - $this->chatManager->addSystemMessage( + $systemMessageComment = $this->chatManager->deleteMessage( $this->room, + $messageId, $attendee->getActorType(), $attendee->getActorId(), - json_encode(['message' => 'message_deleted', 'parameters' => ['message' => $messageId]]), - $this->timeFactory->getDateTime(), - false + $this->timeFactory->getDateTime() ); - return new DataResponse(); + $systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l); + $this->messageParser->parseMessage($systemMessage); + + $comment = $this->chatManager->getComment($this->room, (string) $messageId); + $message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l); + $this->messageParser->parseMessage($message); + + $data = $systemMessage->toArray(); + $data['parent'] = $message->toArray(); + + return new DataResponse($data); } /** |