Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
f779b9a3
Commit
f779b9a3
authored
Jan 15, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #535. Room doesn't get opened when mixed-case JID is used.
parent
6dcafb5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
2 deletions
+88
-2
converse.js
converse.js
+4
-2
docs/CHANGES.md
docs/CHANGES.md
+1
-0
spec/converse.js
spec/converse.js
+83
-0
No files found.
converse.js
View file @
f779b9a3
...
@@ -2491,7 +2491,7 @@
...
@@ -2491,7 +2491,7 @@
name
=
$name
.
val
().
trim
();
name
=
$name
.
val
().
trim
();
$name
.
val
(
''
);
// Clear the input
$name
.
val
(
''
);
// Clear the input
if
(
name
&&
server
)
{
if
(
name
&&
server
)
{
jid
=
Strophe
.
escapeNode
(
name
.
toLowerCase
())
+
'
@
'
+
server
;
jid
=
Strophe
.
escapeNode
(
name
.
toLowerCase
())
+
'
@
'
+
server
.
toLowerCase
()
;
$name
.
removeClass
(
'
error
'
);
$name
.
removeClass
(
'
error
'
);
$server
.
removeClass
(
'
error
'
);
$server
.
removeClass
(
'
error
'
);
this
.
model
.
save
({
muc_domain
:
server
});
this
.
model
.
save
({
muc_domain
:
server
});
...
@@ -3749,6 +3749,7 @@
...
@@ -3749,6 +3749,7 @@
* (String) jid - The JID of the user whose chat box we want
* (String) jid - The JID of the user whose chat box we want
* (Boolean) create - Should a new chat box be created if none exists?
* (Boolean) create - Should a new chat box be created if none exists?
*/
*/
jid
=
jid
.
toLowerCase
();
var
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
var
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
var
chatbox
=
this
.
get
(
bare_jid
);
var
chatbox
=
this
.
get
(
bare_jid
);
if
(
!
chatbox
&&
create
)
{
if
(
!
chatbox
&&
create
)
{
...
@@ -6375,7 +6376,7 @@
...
@@ -6375,7 +6376,7 @@
'
focus
'
:
view
.
focus
.
bind
(
view
),
'
focus
'
:
view
.
focus
.
bind
(
view
),
'
get
'
:
chatbox
.
get
.
bind
(
chatbox
),
'
get
'
:
chatbox
.
get
.
bind
(
chatbox
),
'
initiateOTR
'
:
chatbox
.
initiateOTR
.
bind
(
chatbox
),
'
initiateOTR
'
:
chatbox
.
initiateOTR
.
bind
(
chatbox
),
'
is_chatroom
'
:
chatbox
.
is_chatroom
,
'
is_chatroom
'
:
view
.
is_chatroom
,
'
maximize
'
:
chatbox
.
maximize
.
bind
(
chatbox
),
'
maximize
'
:
chatbox
.
maximize
.
bind
(
chatbox
),
'
minimize
'
:
chatbox
.
minimize
.
bind
(
chatbox
),
'
minimize
'
:
chatbox
.
minimize
.
bind
(
chatbox
),
'
open
'
:
view
.
show
.
bind
(
view
),
'
open
'
:
view
.
show
.
bind
(
view
),
...
@@ -6581,6 +6582,7 @@
...
@@ -6581,6 +6582,7 @@
throw
new
TypeError
(
'
rooms.open: invalid nick, must be string
'
);
throw
new
TypeError
(
'
rooms.open: invalid nick, must be string
'
);
}
}
var
_transform
=
function
(
jid
)
{
var
_transform
=
function
(
jid
)
{
jid
=
jid
.
toLowerCase
();
var
chatroom
=
converse
.
chatboxes
.
get
(
jid
);
var
chatroom
=
converse
.
chatboxes
.
get
(
jid
);
converse
.
log
(
'
jid
'
);
converse
.
log
(
'
jid
'
);
if
(
!
chatroom
)
{
if
(
!
chatroom
)
{
...
...
docs/CHANGES.md
View file @
f779b9a3
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
down on chat event notifications. [jcbrand]
down on chat event notifications. [jcbrand]
-
#524 Added
`auto_join_on_invite`
parameter for automatically joining chatrooms. [ben]
-
#524 Added
`auto_join_on_invite`
parameter for automatically joining chatrooms. [ben]
-
#521 Not sending presence when connecting after disconnection. [jcbrand]
-
#521 Not sending presence when connecting after disconnection. [jcbrand]
-
#535 Messages not received when room with mixed-case JID is used. [jcbrand]
-
#536 Presence not sent out (in cases where it should) after page refresh. [jcbrand]
-
#536 Presence not sent out (in cases where it should) after page refresh. [jcbrand]
-
#540
`bind is not a function`
error for plugins without
`initialize`
method. [jcbrand]
-
#540
`bind is not a function`
error for plugins without
`initialize`
method. [jcbrand]
-
A chatroom invite might come from someone not in your roster list. [ben]
-
A chatroom invite might come from someone not in your roster list. [ben]
...
...
spec/converse.js
View file @
f779b9a3
...
@@ -317,6 +317,89 @@
...
@@ -317,6 +317,89 @@
},
converse
));
},
converse
));
},
converse
));
},
converse
));
describe
(
"
The
\"
rooms
\"
API
"
,
function
()
{
beforeEach
(
function
()
{
test_utils
.
closeAllChatBoxes
();
test_utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
test_utils
.
createContacts
(
'
current
'
);
});
it
(
"
has a method 'get' which returns a wrapped chat room (if it exists)
"
,
function
()
{
test_utils
.
openChatRoom
(
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
var
jid
=
'
lounge@localhost
'
;
var
room
=
converse_api
.
rooms
.
get
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
expect
(
room
.
is_chatroom
).
toBeTruthy
();
var
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
);
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
chatroomview
.
close
();
// Test with mixed case
test_utils
.
openChatRoom
(
'
Leisure
'
,
'
localhost
'
,
'
dummy
'
);
jid
=
'
Leisure@localhost
'
;
room
=
converse_api
.
rooms
.
get
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
jid
=
'
leisure@localhost
'
;
room
=
converse_api
.
rooms
.
get
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
jid
=
'
leiSure@localhost
'
;
room
=
converse_api
.
rooms
.
get
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
chatroomview
.
close
();
// Non-existing room
jid
=
'
lounge2@localhost
'
;
room
=
converse_api
.
rooms
.
get
(
jid
);
expect
(
typeof
room
===
'
undefined
'
).
toBeTruthy
();
});
it
(
"
has a method 'open' which opens and returns a wrapped chat box
"
,
function
()
{
// Test on chat room that doesn't exist.
var
jid
=
'
lounge@localhost
'
;
var
room
=
converse_api
.
rooms
.
open
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
expect
(
room
.
is_chatroom
).
toBeTruthy
();
var
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
);
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
// Test again, now that the room exists.
room
=
converse_api
.
rooms
.
open
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
expect
(
room
.
is_chatroom
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
);
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
// Test with mixed case in JID
jid
=
'
Leisure@localhost
'
;
room
=
converse_api
.
rooms
.
open
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
jid
=
'
leisure@localhost
'
;
room
=
converse_api
.
rooms
.
open
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
jid
=
'
leiSure@localhost
'
;
room
=
converse_api
.
rooms
.
open
(
jid
);
expect
(
room
instanceof
Object
).
toBeTruthy
();
chatroomview
=
converse
.
chatboxviews
.
get
(
jid
.
toLowerCase
());
expect
(
chatroomview
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
chatroomview
.
close
();
});
});
describe
(
"
The
\"
settings
\"
API
"
,
$
.
proxy
(
function
()
{
describe
(
"
The
\"
settings
\"
API
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
test_utils
.
closeAllChatBoxes
();
test_utils
.
closeAllChatBoxes
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment