Commit 6e86fe33 authored by JC Brand's avatar JC Brand

Fixes #1913. Can't connect to non-ascii JID

parent 09371712
/* global mock */ /* global mock, converse */
describe("Converse", function() { describe("Converse", function() {
...@@ -277,7 +277,7 @@ describe("Converse", function() { ...@@ -277,7 +277,7 @@ describe("Converse", function() {
// Test for one JID // Test for one JID
chat = await _converse.api.chats.open(jid); chat = await _converse.api.chats.open(jid);
expect(chat instanceof Object).toBeTruthy(); expect(chat instanceof Object).toBeTruthy();
expect(chat.get('box_id')).toBe(`box-${btoa(jid)}`); expect(chat.get('box_id')).toBe(`box-${jid}`);
const view = _converse.chatboxviews.get(jid); const view = _converse.chatboxviews.get(jid);
await u.waitUntil(() => u.isVisible(view.el)); await u.waitUntil(() => u.isVisible(view.el));
...@@ -286,8 +286,8 @@ describe("Converse", function() { ...@@ -286,8 +286,8 @@ describe("Converse", function() {
await u.waitUntil(() => _converse.chatboxes.length == 3); await u.waitUntil(() => _converse.chatboxes.length == 3);
const list = await _converse.api.chats.get([jid, jid2]); const list = await _converse.api.chats.get([jid, jid2]);
expect(Array.isArray(list)).toBeTruthy(); expect(Array.isArray(list)).toBeTruthy();
expect(list[0].get('box_id')).toBe(`box-${btoa(jid)}`); expect(list[0].get('box_id')).toBe(`box-${jid}`);
expect(list[1].get('box_id')).toBe(`box-${btoa(jid2)}`); expect(list[1].get('box_id')).toBe(`box-${jid2}`);
done(); done();
})); }));
...@@ -307,7 +307,7 @@ describe("Converse", function() { ...@@ -307,7 +307,7 @@ describe("Converse", function() {
chat = await _converse.api.chats.open(jid); chat = await _converse.api.chats.open(jid);
expect(chat instanceof Object).toBeTruthy(); expect(chat instanceof Object).toBeTruthy();
expect(chat.get('box_id')).toBe(`box-${btoa(jid)}`); expect(chat.get('box_id')).toBe(`box-${jid}`);
expect( expect(
Object.keys(chat), Object.keys(chat),
['close', 'endOTR', 'focus', 'get', 'initiateOTR', 'is_chatroom', 'maximize', 'minimize', 'open', 'set'] ['close', 'endOTR', 'focus', 'get', 'initiateOTR', 'is_chatroom', 'maximize', 'minimize', 'open', 'set']
...@@ -317,8 +317,8 @@ describe("Converse", function() { ...@@ -317,8 +317,8 @@ describe("Converse", function() {
// Test for multiple JIDs // Test for multiple JIDs
const list = await _converse.api.chats.open([jid, jid2]); const list = await _converse.api.chats.open([jid, jid2]);
expect(Array.isArray(list)).toBeTruthy(); expect(Array.isArray(list)).toBeTruthy();
expect(list[0].get('box_id')).toBe(`box-${btoa(jid)}`); expect(list[0].get('box_id')).toBe(`box-${jid}`);
expect(list[1].get('box_id')).toBe(`box-${btoa(jid2)}`); expect(list[1].get('box_id')).toBe(`box-${jid2}`);
done(); done();
})); }));
}); });
......
...@@ -330,7 +330,7 @@ converse.plugins.add('converse-chat', { ...@@ -330,7 +330,7 @@ converse.plugins.add('converse-chat', {
// but we're in embedded mode. // but we're in embedded mode.
return; return;
} }
this.set({'box_id': `box-${btoa(jid)}`}); this.set({'box_id': `box-${jid}`});
this.initNotifications(); this.initNotifications();
this.initMessages(); this.initMessages();
......
...@@ -66,7 +66,7 @@ converse.plugins.add('converse-headlines', { ...@@ -66,7 +66,7 @@ converse.plugins.add('converse-headlines', {
initialize () { initialize () {
this.initMessages(); this.initMessages();
this.set({'box_id': `box-${btoa(this.get('jid'))}`}); this.set({'box_id': `box-${this.get('jid')}`});
/** /**
* Triggered once a {@link _converse.HeadlinesBox} has been created and initialized. * Triggered once a {@link _converse.HeadlinesBox} has been created and initialized.
* @event _converse#headlinesBoxInitialized * @event _converse#headlinesBoxInitialized
......
...@@ -384,7 +384,7 @@ converse.plugins.add('converse-muc', { ...@@ -384,7 +384,7 @@ converse.plugins.add('converse-muc', {
async initialize () { async initialize () {
this.initialized = u.getResolveablePromise(); this.initialized = u.getResolveablePromise();
this.debouncedRejoin = debounce(this.rejoin, 250); this.debouncedRejoin = debounce(this.rejoin, 250);
this.set('box_id', `box-${btoa(this.get('jid'))}`); this.set('box_id', `box-${this.get('jid')}`);
this.initNotifications(); this.initNotifications();
this.initMessages(); this.initMessages();
this.initOccupants(); this.initOccupants();
......
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