Show warning when replying as an invisible participant
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Sep 2023 12:33:26 +0000 (14:33 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Sep 2023 12:52:50 +0000 (14:52 +0200)
see https://www.woltlab.com/community/thread/301789-warnung-%C3%BCber-dem-editor-wenn-man-ein-unsichtbarer-konversationsteilnehmer-ist/

files/js/WoltLabSuite/Core/Conversation/Ui/Message/Reply.js [new file with mode: 0644]
language/de.xml
language/en.xml
templates/conversation.tpl
templates/conversationQuickReply.tpl
ts/WoltLabSuite/Core/Conversation/Ui/Message/Reply.ts [new file with mode: 0644]

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 (file)
index 0000000..7942cb6
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Handles the quick reply for conversations.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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;
+});
index 68f3da39beb657f9d97372aba846cf2d0b3b8e1e..73fcf1cf389fcdb100ebe72bd4e740b35af7fedf 100644 (file)
                <item name="wcf.conversation.error.mailboxIsFull"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} das zulässige Limit für Konversationen bereits erreicht und {if LANGUAGE_USE_INFORMAL_VARIANT}kannst{else}können{/if} keine neuen Konversationen starten.]]></item>
                <item name="wcf.conversation.message.editNote"><![CDATA[{$message->username} hat diese Nachricht {#$message->editCount} Mal editiert, zuletzt: {time time=$message->lastEditTime}.]]></item>
                <item name="wcf.conversation.noParticipantsWarning"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du bist{else}Sie sind{/if} dabei, auf eine Konversation ohne weitere Teilnehmer zu antworten. Alle anderen Teilnehmer haben diese Konversation verlassen. Niemand wird {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Nachricht lesen!]]></item>
+               <item name="wcf.conversation.invisibleParticipantWarning"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du bist{else}Sie sind{/if} als unsichtbarer Teilnehmer dabei, auf diese Konversation zu antworten. Eine Antwort wird {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Teilnahme an dieser Konversation für jeden anderen Teilnehmer sichtbar machen und die Antwort für jeden Teilnehmer sichtbar sein.]]></item>
                <item name="wcf.conversation.message.permalink"><![CDATA[Permalink zur {#$startIndex}. Nachricht]]></item>
                <item name="wcf.conversation.markAsRead.doubleClick"><![CDATA[Konversation durch Doppelklick als gelesen markieren]]></item>
                <item name="wcf.conversation.visibility"><![CDATA[Leseberechtigung]]></item>
index 8cbf192e92e8aeaeec40de2251b969e36a9dba31..02cab2226b4c538885779e3b0a7f13002b84be2d 100644 (file)
                <item name="wcf.conversation.error.mailboxIsFull"><![CDATA[You have reached your maximum conversations limit and cannot create new conversations.]]></item>
                <item name="wcf.conversation.message.editNote"><![CDATA[{$message->username} edited this message {#$message->editCount} times, last: {time time=$message->lastEditTime}.]]></item>
                <item name="wcf.conversation.noParticipantsWarning"><![CDATA[You are about to reply to a conversation without other participants, nobody is going to read your message!]]></item>
+               <item name="wcf.conversation.invisibleParticipantWarning"><![CDATA[You are about to reply to this conversation as an invisible participant. Sending a reply will make your participation visible to all other participants and the reply will be visible to all participants.]]></item>
                <item name="wcf.conversation.message.permalink"><![CDATA[Permalink to {#$startIndex}. message]]></item>
                <item name="wcf.conversation.markAsRead.doubleClick"><![CDATA[Double-Click to Mark This Conversation Read]]></item>
                <item name="wcf.conversation.visibility"><![CDATA[Read Access]]></item>
index 0ad06769f7cafa18416d529fc6c8767dfc76f7b0..dfde4b6da0a497ea4fdc636befcc178ac6ed10d5 100644 (file)
                });
                
                {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'
                                        },
index b66377f0ad304b0bf3a4f204f27e4b0d4a54d33b..acb5aa3f2f092a1dbe499e5034b42963e420511c 100644 (file)
@@ -5,7 +5,10 @@
                <div class="messageContent messageQuickReplyContent"{if $pageNo < $pages} data-placeholder="{lang}wcf.conversation.reply{/lang}"{/if}>
                        <div class="messageBody">
                                {if !$conversation->isDraft && !$conversation->hasOtherParticipants()}
-                                       <p class="warning"  role="status" style="margin-bottom: 14px">{lang}wcf.conversation.noParticipantsWarning{/lang}</p>
+                                       <p class="warning" role="status">{lang}wcf.conversation.noParticipantsWarning{/lang}</p>
+                               {/if}
+                               {if $participants[$__wcf->user->userID]->isInvisible}
+                                       <p class="warning invisibleParticipantWarning" role="status">{lang}wcf.conversation.invisibleParticipantWarning{/lang}</p>
                                {/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 (file)
index 0000000..56d0ebb
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Handles the quick reply for conversations.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @woltlabExcludeBundle tiny
+ */
+
+import UiMessageReply from "WoltLabSuite/Core/Ui/Message/Reply";
+
+export class Reply extends UiMessageReply {
+  _insertMessage(...args: Parameters<UiMessageReply["_insertMessage"]>): ReturnType<UiMessageReply["_insertMessage"]> {
+    this._content.querySelector(".invisibleParticipantWarning")?.remove();
+
+    super._insertMessage(...args);
+  }
+}
+
+export default Reply;