diff --git a/files_wcf/js/Bastelstu.be/Chat.js b/files_wcf/js/Bastelstu.be/Chat.js index 86bc092..0737743 100644 --- a/files_wcf/js/Bastelstu.be/Chat.js +++ b/files_wcf/js/Bastelstu.be/Chat.js @@ -4,7 +4,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2024-10-31 + * Change Date: 2024-11-01 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -178,8 +178,11 @@ define([ './Chat/console' this.ui = this.bottle.container.Ui this.ui.bootstrap() - this.bottle.container.UiInput.on('submit', this.onSubmit.bind(this)) - this.bottle.container.UiInput.on('autocomplete', this.onAutocomplete.bind(this)) + this.ui.input.on('submit', this.onSubmit.bind(this)) + this.ui.input.on('autocomplete', this.onAutocomplete.bind(this)) + this.ui.attachmentUpload.on('send', (event) => { + event.detail.promise = this.onSendAttachment(event) + }) await this.bottle.container.Room.join() @@ -330,6 +333,10 @@ define([ './Chat/console' } } + async onSendAttachment(event) { + return this.bottle.container.Messenger.pushAttachment(event.detail.attachmentId) + } + onAutocomplete(event) { const input = event.target const value = input.getText(true) diff --git a/files_wcf/js/Bastelstu.be/Chat/Messenger.js b/files_wcf/js/Bastelstu.be/Chat/Messenger.js index 1be5976..2ae817c 100644 --- a/files_wcf/js/Bastelstu.be/Chat/Messenger.js +++ b/files_wcf/js/Bastelstu.be/Chat/Messenger.js @@ -1,10 +1,10 @@ /* - * Copyright (c) 2010-2018 Tim Düsterhus. + * Copyright (c) 2010-2020 Tim Düsterhus. * * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2024-10-20 + * Change Date: 2024-11-01 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -56,6 +56,14 @@ define([ './console' return Ajax.api(this, payload) } + async pushAttachment(attachmentId) { + const payload = { actionName: 'pushAttachment' + , parameters: { attachmentId } + } + + return Ajax.api(this, payload) + } + _ajaxSetup() { return { silent: true , ignoreError: true