Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112198
D111.1732277024.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D111.1732277024.diff
View Options
diff --git a/src/contents/ui/SendMessageBox.qml b/src/contents/ui/SendMessageBox.qml
--- a/src/contents/ui/SendMessageBox.qml
+++ b/src/contents/ui/SendMessageBox.qml
@@ -253,6 +253,7 @@
}
ToolButton {
+ objectName: 'sendButton'
action: sendAction
display: AbstractButton.IconOnly
}
@@ -307,6 +308,7 @@
sendMessageBox.draftRelType = '';
sendMessageBox.draftRelatedTo = '';
}
+ enabled: textArea.text !== ''
}
Kirigami.Action {
id: sendMediaFileAction
diff --git a/src/tests/quick-tests/tst_SendMessageBox.qml b/src/tests/quick-tests/tst_SendMessageBox.qml
--- a/src/tests/quick-tests/tst_SendMessageBox.qml
+++ b/src/tests/quick-tests/tst_SendMessageBox.qml
@@ -20,6 +20,7 @@
width: 800
height: 600
+ property var mockHelper: TestHelpers.MockHelper {}
function makeRoom () {
return {
timeline () {
@@ -41,6 +42,8 @@
members () {
return membersModel;
},
+ setTyping: mockHelper.noop(),
+ sendTextMessage: mockHelper.noop(),
};
}
@@ -73,6 +76,7 @@
function init() {
membersModel.count = 2;
findChild(sendMessageBox, 'draftMessage').text = '';
+ mockHelper.clearAll();
}
function test_empty() {
@@ -204,5 +208,18 @@
const completionPopup = findChild(sendMessageBox, 'completionPopup');
tryVerify(() => !completionPopup.opened);
}
+
+ function test_emptySend() {
+ mouseClick(findChild(sendMessageBox, 'sendButton'));
+ verify(room.sendTextMessage.calledTimes() === 0);
+
+ const textArea = findChild(sendMessageBox, 'draftMessage');
+ mouseClick(textArea);
+ tryVerify(() => textArea.activeFocus);
+ keySequence('Ctrl+Enter');
+ verify(room.sendTextMessage.calledTimes() === 0);
+ keySequence('Ctrl+Return');
+ verify(room.sendTextMessage.calledTimes() === 0);
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 4:03 AM (13 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38832
Default Alt Text
D111.1732277024.diff (1 KB)
Attached To
Mode
D111: Prevent user from sending an empty message
Attached
Detach File
Event Timeline
Log In to Comment