mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Improve attachment error handling
This commit is contained in:
parent
a0557e3178
commit
09892db6f1
@ -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 @@ public function validatePushAttachment() {
|
||||
$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');
|
||||
}
|
||||
|
||||
|
@ -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 @@ #tpl_chat_log {
|
||||
.attachmentPreview {
|
||||
text-align: center;
|
||||
|
||||
.error {
|
||||
margin-top: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
img {
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user