Commit fbf2e56b authored by JC Brand's avatar JC Brand

converse-muc: Cache the room configuration on the Backbone.Model object

parent 6379676c
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
it("can be configured if you're its owner", mock.initConverse(function (converse) { it("can be configured if you're its owner", mock.initConverse(function (converse) {
converse_api.rooms.open('room@conference.example.org', {'nick': 'some1'}); converse_api.rooms.open('room@conference.example.org', {'nick': 'some1'});
var view = converse.chatboxviews.get('room@conference.example.org'); var view = converse.chatboxviews.get('room@conference.example.org');
spyOn(view, 'showConfigureButtonIfRoomOwner').andCallThrough(); spyOn(view, 'findAndSaveOwnAffiliation').andCallThrough();
/* <presence to="dummy@localhost/converse.js-29092160" /* <presence to="dummy@localhost/converse.js-29092160"
* from="room@conference.example.org/some1"> * from="room@conference.example.org/some1">
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
}).up() }).up()
.c('status', {code: '110'}); .c('status', {code: '110'});
converse.connection._dataRecv(test_utils.createRequest(presence)); converse.connection._dataRecv(test_utils.createRequest(presence));
expect(view.showConfigureButtonIfRoomOwner).toHaveBeenCalled(); expect(view.findAndSaveOwnAffiliation).toHaveBeenCalled();
expect(view.$('.configure-chatroom-button').is(':visible')).toBeTruthy(); expect(view.$('.configure-chatroom-button').is(':visible')).toBeTruthy();
expect(view.$('.toggle-chatbox-button').is(':visible')).toBeTruthy(); expect(view.$('.toggle-chatbox-button').is(':visible')).toBeTruthy();
expect(view.$('.toggle-bookmark').is(':visible')).toBeTruthy(); expect(view.$('.toggle-bookmark').is(':visible')).toBeTruthy();
...@@ -738,9 +738,10 @@ ...@@ -738,9 +738,10 @@
* type='unavailable'> * type='unavailable'>
* <x xmlns='http://jabber.org/protocol/muc#user'> * <x xmlns='http://jabber.org/protocol/muc#user'>
* <item affiliation='none' role='none'> * <item affiliation='none' role='none'>
* <actor nick='Fluellen'/> * <actor nick='Fluellen'/>
* <reason>Avaunt, you cullion!</reason> * <reason>Avaunt, you cullion!</reason>
* </item> * </item>
* <status code='110'/>
* <status code='307'/> * <status code='307'/>
* </x> * </x>
* </presence> * </presence>
...@@ -760,6 +761,7 @@ ...@@ -760,6 +761,7 @@
.c('actor').attrs({nick: 'Fluellen'}).up() .c('actor').attrs({nick: 'Fluellen'}).up()
.c('reason').t('Avaunt, you cullion!').up() .c('reason').t('Avaunt, you cullion!').up()
.up() .up()
.c('status').attrs({code:'110'}).up()
.c('status').attrs({code:'307'}).nodeTree; .c('status').attrs({code:'307'}).nodeTree;
var view = converse.chatboxviews.get('lounge@localhost'); var view = converse.chatboxviews.get('lounge@localhost');
......
This diff is collapsed.
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