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>2021-01-15 12:41:54 +0300
committerJoas Schilling <coding@schilljs.com>2021-02-02 15:52:25 +0300
commita7e30320cebb20c5d4c495648a8157928d6737ce (patch)
tree96420510d878ae5b68f29c5897d918e5d0248b0c /lib/Controller/ChatController.php
parent77f6a4ead3891de17295e74acaa976299fa2c616 (diff)
Check max age on deleting
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/ChatController.php')
-rw-r--r--lib/Controller/ChatController.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index c8c0e3e24..cbdd754b7 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -490,6 +490,13 @@ class ChatController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
+ $maxDeleteAge = $this->timeFactory->getDateTime();
+ $maxDeleteAge->sub(new \DateInterval('PT6H'));
+ if ($message->getCreationDateTime() < $maxDeleteAge) {
+ // Message is too old
+ return new DataResponse([], Http::STATUS_BAD_REQUEST);
+ }
+
$systemMessageComment = $this->chatManager->deleteMessage(
$this->room,
$messageId,