From e61853a4adf02f1ca36a4718a96f90cd322aad44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 26 Sep 2023 14:33:26 +0200 Subject: [PATCH] Show warning when replying as an invisible participant see https://www.woltlab.com/community/thread/301789-warnung-%C3%BCber-dem-editor-wenn-man-ein-unsichtbarer-konversationsteilnehmer-ist/ --- .../Core/Conversation/Ui/Message/Reply.js | 22 +++++++++++++++++++ language/de.xml | 1 + language/en.xml | 1 + templates/conversation.tpl | 4 ++-- templates/conversationQuickReply.tpl | 5 ++++- .../Core/Conversation/Ui/Message/Reply.ts | 20 +++++++++++++++++ 6 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 files/js/WoltLabSuite/Core/Conversation/Ui/Message/Reply.js create mode 100644 ts/WoltLabSuite/Core/Conversation/Ui/Message/Reply.ts diff --git a/files/js/WoltLabSuite/Core/Conversation/Ui/Message/Reply.js b/files/js/WoltLabSuite/Core/Conversation/Ui/Message/Reply.js new file mode 100644 index 0000000..7942cb6 --- /dev/null +++ b/files/js/WoltLabSuite/Core/Conversation/Ui/Message/Reply.js @@ -0,0 +1,22 @@ +/** + * Handles the quick reply for conversations. + * + * @author Tim Duesterhus + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle tiny + */ +define(["require", "exports", "tslib", "WoltLabSuite/Core/Ui/Message/Reply"], function (require, exports, tslib_1, Reply_1) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Reply = void 0; + Reply_1 = tslib_1.__importDefault(Reply_1); + class Reply extends Reply_1.default { + _insertMessage(...args) { + this._content.querySelector(".invisibleParticipantWarning")?.remove(); + super._insertMessage(...args); + } + } + exports.Reply = Reply; + exports.default = Reply; +}); diff --git a/language/de.xml b/language/de.xml index 68f3da3..73fcf1c 100644 --- a/language/de.xml +++ b/language/de.xml @@ -131,6 +131,7 @@ username} hat diese Nachricht {#$message->editCount} Mal editiert, zuletzt: {time time=$message->lastEditTime}.]]> + diff --git a/language/en.xml b/language/en.xml index 8cbf192..02cab22 100644 --- a/language/en.xml +++ b/language/en.xml @@ -131,6 +131,7 @@ username} edited this message {#$message->editCount} times, last: {time time=$message->lastEditTime}.]]> + diff --git a/templates/conversation.tpl b/templates/conversation.tpl index 0ad0676..dfde4b6 100644 --- a/templates/conversation.tpl +++ b/templates/conversation.tpl @@ -173,8 +173,8 @@ }); {if $conversation->canReply()} - require(['WoltLabSuite/Core/Ui/Message/Reply'], function(UiMessageReply) { - new UiMessageReply({ + require(['WoltLabSuite/Core/Conversation/Ui/Message/Reply'], function({ Reply }) { + new Reply({ ajax: { className: 'wcf\\data\\conversation\\message\\ConversationMessageAction' }, diff --git a/templates/conversationQuickReply.tpl b/templates/conversationQuickReply.tpl index b66377f..acb5aa3 100644 --- a/templates/conversationQuickReply.tpl +++ b/templates/conversationQuickReply.tpl @@ -5,7 +5,10 @@
{if !$conversation->isDraft && !$conversation->hasOtherParticipants()} -

{lang}wcf.conversation.noParticipantsWarning{/lang}

+

{lang}wcf.conversation.noParticipantsWarning{/lang}

+ {/if} + {if $participants[$__wcf->user->userID]->isInvisible} +

{lang}wcf.conversation.invisibleParticipantWarning{/lang}

{/if} {event name='beforeWysiwyg'} diff --git a/ts/WoltLabSuite/Core/Conversation/Ui/Message/Reply.ts b/ts/WoltLabSuite/Core/Conversation/Ui/Message/Reply.ts new file mode 100644 index 0000000..56d0ebb --- /dev/null +++ b/ts/WoltLabSuite/Core/Conversation/Ui/Message/Reply.ts @@ -0,0 +1,20 @@ +/** + * Handles the quick reply for conversations. + * + * @author Tim Duesterhus + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle tiny + */ + +import UiMessageReply from "WoltLabSuite/Core/Ui/Message/Reply"; + +export class Reply extends UiMessageReply { + _insertMessage(...args: Parameters): ReturnType { + this._content.querySelector(".invisibleParticipantWarning")?.remove(); + + super._insertMessage(...args); + } +} + +export default Reply; -- 2.20.1