1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Gracefully handle deleted messages in MessageAttachmentObjectType

This commit is contained in:
Tim Düsterhus 2023-02-22 17:31:20 +01:00
parent 4579696576
commit ac4178bd36
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
2 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,7 @@ Additional Use Grant: You may use the Licensed Work when your application
uses the Licensed Work for a purpose that does neither uses the Licensed Work for a purpose that does neither
directly or indirectly generate revenue. directly or indirectly generate revenue.
Change Date: 2027-02-02 Change Date: 2027-02-22
Change License: Version 2 or later of the GNU General Public License as Change License: Version 2 or later of the GNU General Public License as
published by the Free Software Foundation. published by the Free Software Foundation.

View File

@ -1,12 +1,12 @@
<?php <?php
/* /*
* Copyright (c) 2010-2022 Tim Düsterhus. * Copyright (c) 2010-2023 Tim Düsterhus.
* *
* Use of this software is governed by the Business Source License * Use of this software is governed by the Business Source License
* included in the LICENSE file. * included in the LICENSE file.
* *
* Change Date: 2026-09-17 * Change Date: 2027-02-22
* *
* On the date above, in accordance with the Business Source * On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2 * License, use of this software will be governed by version 2
@ -35,6 +35,10 @@ public function canDownload($objectID): bool
if ($objectID) { if ($objectID) {
$message = new Message($objectID); $message = new Message($objectID);
if (!$message->messageID) {
return false;
}
\assert($message->getMessageType()->objectType === 'be.bastelstu.chat.messageType.attachment'); \assert($message->getMessageType()->objectType === 'be.bastelstu.chat.messageType.attachment');
$room = $message->getRoom(); $room = $message->getRoom();