Add /close command for chats

This commit is contained in:
JC Brand 2019-11-15 09:41:01 +01:00
parent 16c83877d2
commit 657dd1e6d1
3 changed files with 8 additions and 3 deletions

View File

@ -27,9 +27,10 @@
test_utils.sendMessage(view, '/help');
const info_messages = Array.prototype.slice.call(view.el.querySelectorAll('.chat-info:not(.chat-date)'), 0);
expect(info_messages.length).toBe(3);
expect(info_messages.length).toBe(4);
expect(info_messages.pop().textContent).toBe('/help: Show this menu');
expect(info_messages.pop().textContent).toBe('/me: Write in the third person');
expect(info_messages.pop().textContent).toBe('/close: Close this chat');
expect(info_messages.pop().textContent).toBe('/clear: Remove messages');
const msg = $msg({

View File

@ -754,10 +754,13 @@ converse.plugins.add('converse-chatview', {
if (match[1] === "clear") {
this.clearMessages();
return true;
}
else if (match[1] === "help") {
} else if (match[1] === "close") {
this.close();
return true;
} else if (match[1] === "help") {
const msgs = [
`<strong>/clear</strong>: ${__('Remove messages')}`,
`<strong>/close</strong>: ${__('Close this chat')}`,
`<strong>/me</strong>: ${__('Write in the third person')}`,
`<strong>/help</strong>: ${__('Show this menu')}`
];

View File

@ -1328,6 +1328,7 @@ converse.plugins.add('converse-muc-views', {
`<strong>/admin</strong>: ${__("Change user's affiliation to admin")}`,
`<strong>/ban</strong>: ${__('Ban user by changing their affiliation to outcast')}`,
`<strong>/clear</strong>: ${__('Clear the chat area')}`,
`<strong>/close</strong>: ${__('Close this groupchat')}`,
`<strong>/deop</strong>: ${__('Change user role to participant')}`,
`<strong>/destroy</strong>: ${__('Remove this groupchat')}`,
`<strong>/help</strong>: ${__('Show this menu')}`,