muc: Rename `createChatRoom to openChatRoom`

It doesn't always create a new room.
This commit is contained in:
JC Brand 2017-06-13 17:20:59 +02:00
parent d5b152906f
commit 8191d5e83a
2 changed files with 10 additions and 10 deletions

View File

@ -2088,7 +2088,7 @@
expect($input.length).toBe(1);
expect($server.length).toBe(1);
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 () {
var deferred = new $.Deferred();
deferred.resolve();
@ -2100,7 +2100,7 @@
$nick.val('dummy');
$server.val('muc.localhost');
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
}));

View File

@ -342,7 +342,7 @@
'roomsPanelRendered': new $.Deferred()
});
_converse.createChatRoom = function (settings) {
_converse.openChatRoom = function (settings) {
/* Creates a new chat room, making sure that certain attributes
* are correct, for example that the "type" is set to
* "chatroom".
@ -2372,9 +2372,9 @@
className: 'controlbox-pane',
id: 'chatrooms',
events: {
'submit form.add-chatroom': 'createChatRoom',
'submit form.add-chatroom': 'openChatRoom',
'click input#show-rooms': 'showRooms',
'click a.open-room': 'createChatRoom',
'click a.open-room': 'openChatRoom',
'click a.room-info': 'toggleRoomInfo',
'change input[name=server]': 'setDomain',
'change input[name=nick]': 'setNick'
@ -2571,7 +2571,7 @@
}
},
createChatRoom: function (ev) {
openChatRoom: function (ev) {
ev.preventDefault();
var name, $name, server, $server, jid;
if (ev.type === 'click') {
@ -2594,7 +2594,7 @@
return;
}
}
_converse.createChatRoom({
_converse.openChatRoom({
'id': jid,
'jid': jid,
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
@ -2648,7 +2648,7 @@
}
}
if (result === true) {
var chatroom = _converse.createChatRoom({
var chatroom = _converse.openChatRoom({
'id': room_jid,
'jid': room_jid,
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(room_jid)),
@ -2740,9 +2740,9 @@
if (_.isUndefined(jids)) {
throw new TypeError('rooms.open: You need to provide at least one JID');
} 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) {
if (_.isString(attrs)) {