Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-03-24 09:59:40 +0300
committerJoas Schilling <coding@schilljs.com>2022-03-24 23:50:31 +0300
commit625439702e54eaf36b84f51e90437cb59191a641 (patch)
tree757c4a17cfb7a87d46560b02e68f371e62570cf6 /lib/Controller/ChatController.php
parentae62e05fdde9e734ee03c8763190dd96fc3531bb (diff)
Allow to delete files and object shares on the API
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/ChatController.php')
-rw-r--r--lib/Controller/ChatController.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index df22cabe0..185051aac 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -53,6 +53,7 @@ use OCP\IUserManager;
use OCP\RichObjectStrings\InvalidObjectExeption;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\ITrustedDomainHelper;
+use OCP\Share\Exceptions\ShareNotFound;
use OCP\User\Events\UserLiveStatusEvent;
use OCP\UserStatus\IManager as IUserStatusManager;
use OCP\UserStatus\IUserStatus;
@@ -581,8 +582,8 @@ class ChatController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
- if ($message->getVerb() !== 'comment') {
- // System message or file share (since the message is not parsed, it has type "system")
+ if ($message->getVerb() !== 'comment' && $message->getVerb() !== 'object_shared') {
+ // System message (since the message is not parsed, it has type "system")
return new DataResponse([], Http::STATUS_METHOD_NOT_ALLOWED);
}
@@ -593,13 +594,16 @@ class ChatController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
- $systemMessageComment = $this->chatManager->deleteMessage(
- $this->room,
- $messageId,
- $attendee->getActorType(),
- $attendee->getActorId(),
- $this->timeFactory->getDateTime()
- );
+ try {
+ $systemMessageComment = $this->chatManager->deleteMessage(
+ $this->room,
+ $message,
+ $this->participant,
+ $this->timeFactory->getDateTime()
+ );
+ } catch (ShareNotFound $e) {
+ return new DataResponse([], Http::STATUS_NOT_FOUND);
+ }
$systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l);
$this->messageParser->parseMessage($systemMessage);