Fix: type error trim of undefined#2595 (#2702)

This commit is contained in:
Sanju 2021-07-27 07:38:27 +05:30 committed by GitHub
parent d7da6fbfb5
commit 359c3c8ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,7 +169,7 @@ export default {
return this.maxLength - this.message.length; return this.maxLength - this.message.length;
}, },
isReplyButtonDisabled() { isReplyButtonDisabled() {
const isMessageEmpty = !this.message.trim().replace(/\n/g, '').length; const isMessageEmpty = this.isMessageEmpty;
if (this.hasAttachments) return false; if (this.hasAttachments) return false;
return ( return (
@ -235,6 +235,12 @@ export default {
isOnPrivateNote() { isOnPrivateNote() {
return this.replyType === REPLY_EDITOR_MODES.NOTE; return this.replyType === REPLY_EDITOR_MODES.NOTE;
}, },
isMessageEmpty() {
if(!this.message) {
this.message = '';
}
return !this.message.trim().replace(/\n/g, '').length;
},
}, },
watch: { watch: {
currentChat(conversation) { currentChat(conversation) {