Commit e02c044a authored by JC Brand's avatar JC Brand

Refactored notification code

responsible for showing messages based on the extended presence information.

- Use DOM API instead of jQuery
- Make info messages overridable (allows also for disabling them)
- Break up large function with inline callbacks into smaller ones
parent ebc7409d
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
'type': 'result', 'type': 'result',
'id': IQ_id, 'id': IQ_id,
'from': view.model.get('jid'), 'from': view.model.get('jid'),
'to': converse.connection.jid 'to': converse.connection.jid
}).c('query', {'xmlns': 'http://jabber.org/protocol/disco#info', 'node': 'x-roomuser-item'}) }).c('query', {'xmlns': 'http://jabber.org/protocol/disco#info', 'node': 'x-roomuser-item'})
.c('identity', {'category': 'conference', 'name': 'thirdwitch', 'type': 'text'}); .c('identity', {'category': 'conference', 'name': 'thirdwitch', 'type': 'text'});
converse.connection._dataRecv(test_utils.createRequest(stanza)); converse.connection._dataRecv(test_utils.createRequest(stanza));
...@@ -529,7 +529,7 @@ ...@@ -529,7 +529,7 @@
expect($occupants.children().first(0).text()).toBe("oldnick"); expect($occupants.children().first(0).text()).toBe("oldnick");
expect($chat_content.find('div.chat-info').length).toBe(1); expect($chat_content.find('div.chat-info').length).toBe(1);
expect($chat_content.find('div.chat-info').html()).toBe(__(view.newNicknameMessages["210"], "oldnick")); expect($chat_content.find('div.chat-info').html()).toBe(__(converse.muc.newNicknameMessages["210"], "oldnick"));
presence = $pres().attrs({ presence = $pres().attrs({
from:'lounge@localhost/oldnick', from:'lounge@localhost/oldnick',
...@@ -549,7 +549,7 @@ ...@@ -549,7 +549,7 @@
converse.connection._dataRecv(test_utils.createRequest(presence)); converse.connection._dataRecv(test_utils.createRequest(presence));
expect($chat_content.find('div.chat-info').length).toBe(2); expect($chat_content.find('div.chat-info').length).toBe(2);
expect($chat_content.find('div.chat-info').last().html()).toBe(__(view.newNicknameMessages["303"], "newnick")); expect($chat_content.find('div.chat-info').last().html()).toBe(__(converse.muc.newNicknameMessages["303"], "newnick"));
$occupants = view.$('.occupant-list'); $occupants = view.$('.occupant-list');
expect($occupants.children().length).toBe(0); expect($occupants.children().length).toBe(0);
...@@ -569,7 +569,7 @@ ...@@ -569,7 +569,7 @@
converse.connection._dataRecv(test_utils.createRequest(presence)); converse.connection._dataRecv(test_utils.createRequest(presence));
expect($chat_content.find('div.chat-info').length).toBe(2); expect($chat_content.find('div.chat-info').length).toBe(2);
expect($chat_content.find('div.chat-info').last().html()).toBe(__(view.newNicknameMessages["303"], "newnick")); expect($chat_content.find('div.chat-info').last().html()).toBe(__(converse.muc.newNicknameMessages["303"], "newnick"));
$occupants = view.$('.occupant-list'); $occupants = view.$('.occupant-list');
expect($occupants.children().length).toBe(1); expect($occupants.children().length).toBe(1);
expect($occupants.children().first(0).text()).toBe("newnick"); expect($occupants.children().first(0).text()).toBe("newnick");
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
converse_api.listen.not(); converse_api.listen.not();
test_utils.clearBrowserStorage(); test_utils.clearBrowserStorage();
}); });
var submitRoomForm = function (converse) { var submitRoomForm = function (converse) {
var roomspanel = converse.chatboxviews.get('controlbox').roomspanel; var roomspanel = converse.chatboxviews.get('controlbox').roomspanel;
var $input = roomspanel.$el.find('input.new-chatroom-name'); var $input = roomspanel.$el.find('input.new-chatroom-name');
......
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