Warn the user before they ping the whole room
4 files changed, 43 insertions, 1 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index e1bf3f06..c95929ce 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -268,7 +268,7 @@ Rectangle {
function onRoomChanged() {
messageInput.clear();
if (room)
- messageInput.append(room.input.text());
+ messageInput.append(room.input.text);
popup.completerName = "";
messageInput.forceActiveFocus();
diff --git a/resources/qml/NotificationWarning.qml b/resources/qml/NotificationWarning.qml
new file mode 100644
index 00000000..b606581b
--- /dev/null
+++ b/resources/qml/NotificationWarning.qml
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: 2021 Nheko Contributors
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import QtQuick 2.9
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.2
+import im.nheko 1.0
+
+Item {
+ implicitHeight: warningRect.visible ? warningDisplay.implicitHeight : 0
+ height: implicitHeight
+ Layout.fillWidth: true
+
+ Rectangle {
+ id: warningRect
+
+ visible: (room && room.permissions.canPingRoom && room.input.containsAtRoom)
+ color: Nheko.colors.base
+ anchors.fill: parent
+ z: 3
+
+ Label {
+ id: warningDisplay
+
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ anchors.bottom: parent.bottom
+ color: Nheko.theme.red
+ text: qsTr("You will be pinging the whole room")
+ textFormat: Text.PlainText
+ }
+
+ }
+
+}
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 9bc4bef0..f12060f2 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -123,6 +123,9 @@ Item {
color: Nheko.theme.separator
}
+ NotificationWarning {
+ }
+
ReplyPopup {
}
diff --git a/resources/res.qrc b/resources/res.qrc
index b46b726c..3514ebca 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -138,6 +138,7 @@
<file>qml/QuickSwitcher.qml</file>
<file>qml/ForwardCompleter.qml</file>
<file>qml/TypingIndicator.qml</file>
+ <file>qml/NotificationWarning.qml</file>
<file>qml/RoomSettings.qml</file>
<file>qml/emoji/EmojiPicker.qml</file>
<file>qml/emoji/StickerPicker.qml</file>
|