Commit 657dd1e6 authored by JC Brand's avatar JC Brand

Add /close command for chats

parent 16c83877
...@@ -27,9 +27,10 @@ ...@@ -27,9 +27,10 @@
test_utils.sendMessage(view, '/help'); test_utils.sendMessage(view, '/help');
const info_messages = Array.prototype.slice.call(view.el.querySelectorAll('.chat-info:not(.chat-date)'), 0); 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('/help: Show this menu');
expect(info_messages.pop().textContent).toBe('/me: Write in the third person'); 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'); expect(info_messages.pop().textContent).toBe('/clear: Remove messages');
const msg = $msg({ const msg = $msg({
......
...@@ -754,10 +754,13 @@ converse.plugins.add('converse-chatview', { ...@@ -754,10 +754,13 @@ converse.plugins.add('converse-chatview', {
if (match[1] === "clear") { if (match[1] === "clear") {
this.clearMessages(); this.clearMessages();
return true; return true;
} } else if (match[1] === "close") {
else if (match[1] === "help") { this.close();
return true;
} else if (match[1] === "help") {
const msgs = [ const msgs = [
`<strong>/clear</strong>: ${__('Remove messages')}`, `<strong>/clear</strong>: ${__('Remove messages')}`,
`<strong>/close</strong>: ${__('Close this chat')}`,
`<strong>/me</strong>: ${__('Write in the third person')}`, `<strong>/me</strong>: ${__('Write in the third person')}`,
`<strong>/help</strong>: ${__('Show this menu')}` `<strong>/help</strong>: ${__('Show this menu')}`
]; ];
......
...@@ -1328,6 +1328,7 @@ converse.plugins.add('converse-muc-views', { ...@@ -1328,6 +1328,7 @@ converse.plugins.add('converse-muc-views', {
`<strong>/admin</strong>: ${__("Change user's affiliation to admin")}`, `<strong>/admin</strong>: ${__("Change user's affiliation to admin")}`,
`<strong>/ban</strong>: ${__('Ban user by changing their affiliation to outcast')}`, `<strong>/ban</strong>: ${__('Ban user by changing their affiliation to outcast')}`,
`<strong>/clear</strong>: ${__('Clear the chat area')}`, `<strong>/clear</strong>: ${__('Clear the chat area')}`,
`<strong>/close</strong>: ${__('Close this groupchat')}`,
`<strong>/deop</strong>: ${__('Change user role to participant')}`, `<strong>/deop</strong>: ${__('Change user role to participant')}`,
`<strong>/destroy</strong>: ${__('Remove this groupchat')}`, `<strong>/destroy</strong>: ${__('Remove this groupchat')}`,
`<strong>/help</strong>: ${__('Show this menu')}`, `<strong>/help</strong>: ${__('Show this menu')}`,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment