diff --git a/files/lib/data/message/MessageAction.class.php b/files/lib/data/message/MessageAction.class.php index 795240a..28c8e88 100644 --- a/files/lib/data/message/MessageAction.class.php +++ b/files/lib/data/message/MessageAction.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2024-11-01 + * Change Date: 2024-11-02 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -318,6 +318,8 @@ class MessageAction extends \wcf\data\AbstractDatabaseObjectAction { $user = new \chat\data\user\User(WCF::getUser()); if (!$user->isInRoom($room)) throw new PermissionDeniedException(); + if (!$room->canWritePublicly(null, $reason)) throw $reason; + $this->readString('tmpHash'); } @@ -337,7 +339,7 @@ class MessageAction extends \wcf\data\AbstractDatabaseObjectAction { foreach ($attachments as $attachment) { $attachmentIDs[] = $attachment->attachmentID; } - + $processor = new \wcf\system\html\input\HtmlInputProcessor(); $processor->process(implode(' ', array_map(function ($attachmentID) { return '[attach='.$attachmentID.',none,true][/attach]'; diff --git a/files/style/be.bastelstu.chat.scss b/files/style/be.bastelstu.chat.scss index d81b96a..32d2176 100644 --- a/files/style/be.bastelstu.chat.scss +++ b/files/style/be.bastelstu.chat.scss @@ -4,7 +4,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2024-11-01 + * Change Date: 2024-11-02 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -570,6 +570,11 @@ $chatEmbedMaxWidth: 400px; .attachmentPreview { text-align: center; + .error { + margin-top: 0; + margin-bottom: 20px; + } + img { margin-left: auto !important; margin-right: auto !important; diff --git a/files_wcf/js/Bastelstu.be/Chat/Ui/Attachment/Upload.js b/files_wcf/js/Bastelstu.be/Chat/Ui/Attachment/Upload.js index 0b7d8ca..cddaa23 100644 --- a/files_wcf/js/Bastelstu.be/Chat/Ui/Attachment/Upload.js +++ b/files_wcf/js/Bastelstu.be/Chat/Ui/Attachment/Upload.js @@ -4,7 +4,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2024-11-01 + * Change Date: 2024-11-02 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -177,8 +177,16 @@ define([ this.deleteOnClose = false this.closeDialog() } catch (error) { - // TODO: Error handling console.error(error) + + let container = this._target.querySelector('.error') + if (!container) { + container = document.createElement('div') + container.classList.add('error') + this._target.insertBefore(container, this._target.firstChild) + } + container.innerText = error.message + Dialog.rebuild(DIALOG_CONTAINER_ID) } }