Improve XEP-0245 support.
Namely: - Only match messages which start with exactly "/me ". - Simplify the match, checking a string instead of a complex regex. - Always remove the first four characters in the case of a match, to not leave an extra leading space.
This commit is contained in:
parent
52aff4f43e
commit
87c77385d8
5
dist/converse.js
vendored
5
dist/converse.js
vendored
@ -61735,7 +61735,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
||||
|
||||
if (text && text !== url) {
|
||||
if (is_me_message) {
|
||||
text = text.replace(/^\/me/, '');
|
||||
text = text.substring(4);
|
||||
}
|
||||
|
||||
text = xss__WEBPACK_IMPORTED_MODULE_9___default.a.filterXSS(text, {
|
||||
@ -61833,8 +61833,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
||||
return false;
|
||||
}
|
||||
|
||||
const match = text.match(/^\/(.*?)(?: (.*))?$/);
|
||||
return match && match[1] === 'me';
|
||||
return text.startsWith('/me ');
|
||||
},
|
||||
|
||||
processMessageText() {
|
||||
|
@ -144,7 +144,7 @@ converse.plugins.add('converse-message-view', {
|
||||
const msg_content = msg.querySelector('.chat-msg__text');
|
||||
if (text && text !== url) {
|
||||
if (is_me_message) {
|
||||
text = text.replace(/^\/me/, '');
|
||||
text = text.substring(4);
|
||||
}
|
||||
text = xss.filterXSS(text, {'whiteList': {}});
|
||||
msg_content.innerHTML = _.flow(
|
||||
@ -239,8 +239,7 @@ converse.plugins.add('converse-message-view', {
|
||||
if (!text) {
|
||||
return false;
|
||||
}
|
||||
const match = text.match(/^\/(.*?)(?: (.*))?$/);
|
||||
return match && match[1] === 'me';
|
||||
return text.startsWith('/me ');
|
||||
},
|
||||
|
||||
processMessageText () {
|
||||
|
Loading…
Reference in New Issue
Block a user