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
e39999f3
Commit
e39999f3
authored
Sep 23, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check bookmarks for nicks when joining rooms
parent
7319ebf0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
4 deletions
+51
-4
spec/bookmarks.js
spec/bookmarks.js
+36
-2
src/converse-bookmarks.js
src/converse-bookmarks.js
+14
-1
src/converse-muc.js
src/converse-muc.js
+1
-1
No files found.
spec/bookmarks.js
View file @
e39999f3
...
...
@@ -233,6 +233,33 @@
});
});
});
describe
(
"
and when autojoin is set
"
,
function
()
{
beforeEach
(
function
()
{
converse
.
bookmarks
.
reset
();
});
it
(
"
will be be opened and joined automatically upon login
"
,
function
()
{
spyOn
(
converse_api
.
rooms
,
'
open
'
);
var
jid
=
'
theplay@conference.shakespeare.lit
'
;
var
model
=
converse
.
bookmarks
.
create
({
'
jid
'
:
jid
,
'
autojoin
'
:
false
,
'
name
'
:
'
The Play
'
,
'
nick
'
:
''
});
expect
(
converse_api
.
rooms
.
open
).
not
.
toHaveBeenCalled
();
converse
.
bookmarks
.
remove
(
model
);
converse
.
bookmarks
.
create
({
'
jid
'
:
jid
,
'
autojoin
'
:
true
,
'
name
'
:
'
Hamlet
'
,
'
nick
'
:
''
});
expect
(
converse_api
.
rooms
.
open
).
toHaveBeenCalled
();
});
});
});
describe
(
"
Bookmarks
"
,
function
()
{
...
...
@@ -345,9 +372,16 @@
'
name
'
:
'
The Play's the Thing
'
,
'
autojoin
'
:
'
true
'
,
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
c
(
'
nick
'
).
t
(
'
JC
'
);
}).
c
(
'
nick
'
).
t
(
'
JC
'
).
up
().
up
()
.
c
(
'
conference
'
,
{
'
name
'
:
'
Another room
'
,
'
autojoin
'
:
'
false
'
,
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
c
(
'
nick
'
).
t
(
'
JC
'
).
up
().
up
();
converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
expect
(
converse
.
bookmarks
.
models
.
length
).
toBe
(
1
);
expect
(
converse
.
bookmarks
.
models
.
length
).
toBe
(
2
);
expect
(
converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
true
);
expect
(
converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
false
);
});
});
}));
src/converse-bookmarks.js
View file @
e39999f3
...
...
@@ -65,6 +65,19 @@
return
this
;
},
checkForReservedNick
:
function
()
{
/* Check if the user has a bookmark with a saved nickanme
* for this room, and if so use it.
* Otherwise delegate to the super method.
*/
var
model
=
converse
.
bookmarks
.
findWhere
({
'
jid
'
:
this
.
model
.
get
(
'
jid
'
)});
if
(
!
_
.
isUndefined
(
model
)
&&
model
.
get
(
'
nick
'
))
{
this
.
join
(
this
.
model
.
get
(
'
nick
'
));
}
else
{
this
.
__super__
.
checkForReservedNick
.
apply
(
this
,
arguments
);
}
},
onBookmarked
:
function
()
{
if
(
this
.
model
.
get
(
'
bookmarked
'
))
{
this
.
$
(
'
.icon-pushpin
'
).
addClass
(
'
button-on
'
);
...
...
@@ -263,7 +276,7 @@
this
.
create
({
'
jid
'
:
bookmark
.
getAttribute
(
'
jid
'
),
'
name
'
:
bookmark
.
getAttribute
(
'
name
'
),
'
autojoin
'
:
bookmark
.
getAttribute
(
'
autojoin
'
),
'
autojoin
'
:
bookmark
.
getAttribute
(
'
autojoin
'
)
===
'
true
'
,
'
nick
'
:
bookmark
.
querySelector
(
'
nick
'
).
textContent
});
}.
bind
(
this
));
...
...
src/converse-muc.js
View file @
e39999f3
...
...
@@ -766,7 +766,7 @@
},
checkForReservedNick
:
function
()
{
/* User service-discovery to as the XMPP server whether
/* User service-discovery to as
k
the XMPP server whether
* this user has a reserved nickname for this room.
* If so, we'll use that, otherwise we render the nickname
* form.
...
...
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