Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
b027f0f7
Commit
b027f0f7
authored
Aug 01, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1143 Disallow sending of empty messages
parent
f120fbd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
CHANGES.md
CHANGES.md
+1
-0
dist/converse.js
dist/converse.js
+7
-5
src/converse-chatview.js
src/converse-chatview.js
+5
-4
No files found.
CHANGES.md
View file @
b027f0f7
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
-
Documentation includes utf-8 charset to make minfied versions compatible across platforms. #1017
-
Documentation includes utf-8 charset to make minfied versions compatible across platforms. #1017
-
#1026 Typing in MUC shows "Typing from another device"
-
#1026 Typing in MUC shows "Typing from another device"
-
#1039 Multi-option data form elements not shown and saved correctly
-
#1039 Multi-option data form elements not shown and saved correctly
-
#1143 Able to send blank message
### API changes
### API changes
...
...
dist/converse.js
View file @
b027f0f7
...
@@ -70266,6 +70266,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -70266,6 +70266,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
ev.preventDefault();
ev.preventDefault();
const textarea = this.el.querySelector('.chat-textarea'),
const textarea = this.el.querySelector('.chat-textarea'),
message = textarea.value;
message = textarea.value;
if (!message.replace(/\s/g, '').length) {
return;
}
let spoiler_hint;
let spoiler_hint;
if (this.model.get('composing_spoiler')) {
if (this.model.get('composing_spoiler')) {
...
@@ -70280,12 +70285,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -70280,12 +70285,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
const event = document.createEvent('Event');
const event = document.createEvent('Event');
event.initEvent('input', true, true);
event.initEvent('input', true, true);
textarea.dispatchEvent(event);
textarea.dispatchEvent(event);
this.onMessageSubmitted(message, spoiler_hint);
if (message !== '') {
_converse.emit('messageSend', message);
this.onMessageSubmitted(message, spoiler_hint);
_converse.emit('messageSend', message);
}
this.setChatState(_converse.ACTIVE);
this.setChatState(_converse.ACTIVE);
},
},
src/converse-chatview.js
View file @
b027f0f7
...
@@ -890,6 +890,9 @@
...
@@ -890,6 +890,9 @@
const
textarea
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
),
const
textarea
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
),
message
=
textarea
.
value
;
message
=
textarea
.
value
;
if
(
!
message
.
replace
(
/
\s
/g
,
''
).
length
)
{
return
;
}
let
spoiler_hint
;
let
spoiler_hint
;
if
(
this
.
model
.
get
(
'
composing_spoiler
'
))
{
if
(
this
.
model
.
get
(
'
composing_spoiler
'
))
{
const
hint_el
=
this
.
el
.
querySelector
(
'
form.sendXMPPMessage input.spoiler-hint
'
);
const
hint_el
=
this
.
el
.
querySelector
(
'
form.sendXMPPMessage input.spoiler-hint
'
);
...
@@ -903,10 +906,8 @@
...
@@ -903,10 +906,8 @@
event
.
initEvent
(
'
input
'
,
true
,
true
);
event
.
initEvent
(
'
input
'
,
true
,
true
);
textarea
.
dispatchEvent
(
event
);
textarea
.
dispatchEvent
(
event
);
if
(
message
!==
''
)
{
this
.
onMessageSubmitted
(
message
,
spoiler_hint
);
this
.
onMessageSubmitted
(
message
,
spoiler_hint
);
_converse
.
emit
(
'
messageSend
'
,
message
);
_converse
.
emit
(
'
messageSend
'
,
message
);
}
this
.
setChatState
(
_converse
.
ACTIVE
);
this
.
setChatState
(
_converse
.
ACTIVE
);
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment