Skip to content

Commit

Permalink
fixup! feat(chat): Add basic handling of editing
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvergessen committed Dec 13, 2023
1 parent eec133f commit b1e5614
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/Chat/ChatManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,18 +464,11 @@ public function editMessage(Room $chat, IComment $comment, Participant $particip

// $this->attachmentService->deleteAttachmentByMessageId((int) $comment->getId());

$metaData = [];
if ($comment->getMetaData()) {
try {
$metaData = (array) json_decode($comment->getMetaData(), true, flags: JSON_THROW_ON_ERROR);
} catch (\JsonException) {
}
}

$metaData = $comment->getMetaData() ?? [];

Check failure on line 467 in lib/Chat/ChatManager.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedInterfaceMethod

lib/Chat/ChatManager.php:467:25: UndefinedInterfaceMethod: Method OCP\Comments\IComment::getMetaData does not exist (see https://psalm.dev/181)
$metaData['last_edited_by_type'] = $participant->getAttendee()->getActorType();
$metaData['last_edited_by_id'] = $participant->getAttendee()->getActorId();
$metaData['last_edited_time'] = $editTime->getTimestamp();
$comment->setMetaData(json_encode($metaData));
$comment->setMetaData($metaData);

Check failure on line 471 in lib/Chat/ChatManager.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedInterfaceMethod

lib/Chat/ChatManager.php:471:13: UndefinedInterfaceMethod: Method OCP\Comments\IComment::setMetaData does not exist (see https://psalm.dev/181)
$comment->setMessage($message, self::MAX_CHAT_LENGTH);
$this->commentsManager->save($comment);
$this->referenceManager->invalidateCache($chat->getToken());
Expand Down

0 comments on commit b1e5614

Please sign in to comment.