Commit 8191d5e8 authored by JC Brand's avatar JC Brand

muc: Rename ``createChatRoom`` to ``openChatRoom``

It doesn't always create a new room.
parent d5b15290
...@@ -2088,7 +2088,7 @@ ...@@ -2088,7 +2088,7 @@
expect($input.length).toBe(1); expect($input.length).toBe(1);
expect($server.length).toBe(1); expect($server.length).toBe(1);
expect($('.chatroom:visible').length).toBe(0); // There shouldn't be any chatrooms open currently expect($('.chatroom:visible').length).toBe(0); // There shouldn't be any chatrooms open currently
spyOn(roomspanel, 'createChatRoom').and.callThrough(); spyOn(roomspanel, 'openChatRoom').and.callThrough();
spyOn(_converse.ChatRoomView.prototype, 'getRoomFeatures').and.callFake(function () { spyOn(_converse.ChatRoomView.prototype, 'getRoomFeatures').and.callFake(function () {
var deferred = new $.Deferred(); var deferred = new $.Deferred();
deferred.resolve(); deferred.resolve();
...@@ -2100,7 +2100,7 @@ ...@@ -2100,7 +2100,7 @@
$nick.val('dummy'); $nick.val('dummy');
$server.val('muc.localhost'); $server.val('muc.localhost');
roomspanel.$el.find('form').submit(); roomspanel.$el.find('form').submit();
expect(roomspanel.createChatRoom).toHaveBeenCalled(); expect(roomspanel.openChatRoom).toHaveBeenCalled();
expect($('.chatroom:visible').length).toBe(1); // There should now be an open chatroom expect($('.chatroom:visible').length).toBe(1); // There should now be an open chatroom
})); }));
......
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
'roomsPanelRendered': new $.Deferred() 'roomsPanelRendered': new $.Deferred()
}); });
_converse.createChatRoom = function (settings) { _converse.openChatRoom = function (settings) {
/* Creates a new chat room, making sure that certain attributes /* Creates a new chat room, making sure that certain attributes
* are correct, for example that the "type" is set to * are correct, for example that the "type" is set to
* "chatroom". * "chatroom".
...@@ -2372,9 +2372,9 @@ ...@@ -2372,9 +2372,9 @@
className: 'controlbox-pane', className: 'controlbox-pane',
id: 'chatrooms', id: 'chatrooms',
events: { events: {
'submit form.add-chatroom': 'createChatRoom', 'submit form.add-chatroom': 'openChatRoom',
'click input#show-rooms': 'showRooms', 'click input#show-rooms': 'showRooms',
'click a.open-room': 'createChatRoom', 'click a.open-room': 'openChatRoom',
'click a.room-info': 'toggleRoomInfo', 'click a.room-info': 'toggleRoomInfo',
'change input[name=server]': 'setDomain', 'change input[name=server]': 'setDomain',
'change input[name=nick]': 'setNick' 'change input[name=nick]': 'setNick'
...@@ -2571,7 +2571,7 @@ ...@@ -2571,7 +2571,7 @@
} }
}, },
createChatRoom: function (ev) { openChatRoom: function (ev) {
ev.preventDefault(); ev.preventDefault();
var name, $name, server, $server, jid; var name, $name, server, $server, jid;
if (ev.type === 'click') { if (ev.type === 'click') {
...@@ -2594,7 +2594,7 @@ ...@@ -2594,7 +2594,7 @@
return; return;
} }
} }
_converse.createChatRoom({ _converse.openChatRoom({
'id': jid, 'id': jid,
'jid': jid, 'jid': jid,
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)), 'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
...@@ -2648,7 +2648,7 @@ ...@@ -2648,7 +2648,7 @@
} }
} }
if (result === true) { if (result === true) {
var chatroom = _converse.createChatRoom({ var chatroom = _converse.openChatRoom({
'id': room_jid, 'id': room_jid,
'jid': room_jid, 'jid': room_jid,
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(room_jid)), 'name': Strophe.unescapeNode(Strophe.getNodeFromJid(room_jid)),
...@@ -2740,9 +2740,9 @@ ...@@ -2740,9 +2740,9 @@
if (_.isUndefined(jids)) { if (_.isUndefined(jids)) {
throw new TypeError('rooms.open: You need to provide at least one JID'); throw new TypeError('rooms.open: You need to provide at least one JID');
} else if (_.isString(jids)) { } else if (_.isString(jids)) {
return _converse.getChatRoom(jids, attrs, _converse.createChatRoom); return _converse.getChatRoom(jids, attrs, _converse.openChatRoom);
} }
return _.map(jids, _.partial(_converse.getChatRoom, _, attrs, _converse.createChatRoom)); return _.map(jids, _.partial(_converse.getChatRoom, _, attrs, _converse.openChatRoom));
}, },
'get': function (jids, attrs, create) { 'get': function (jids, attrs, create) {
if (_.isString(attrs)) { if (_.isString(attrs)) {
......
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