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
7ae2e469
Commit
7ae2e469
authored
Feb 20, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand tests and found a bug in the process.
updates #785
parent
789654d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
docs/CHANGES.md
docs/CHANGES.md
+1
-1
spec/presence.js
spec/presence.js
+50
-0
src/converse-core.js
src/converse-core.js
+1
-1
No files found.
docs/CHANGES.md
View file @
7ae2e469
...
...
@@ -52,7 +52,7 @@
-
#366 Show the chat room occupant's JID in the tooltip (if you're allowed to see it). [jcbrand]
-
#694 The
`notification_option`
wasn't being used consistently. [jcbrand]
-
#770 Allow setting contact attrs on chats.open [Ape]
-
#785 Add presence priority handling [w3host, jcbrand]
-
#
610, #
785 Add presence priority handling [w3host, jcbrand]
## 2.0.6 (2017-02-13)
...
...
spec/presence.js
View file @
7ae2e469
...
...
@@ -57,6 +57,56 @@
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
priority
'
]).
toBe
(
0
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
status
'
]).
toBe
(
'
xa
'
);
stanza
=
$
(
'
<presence xmlns="jabber:client"
'
+
'
id="tYRdj-35"
'
+
'
to="dummy@localhost/converse.js-21770972"
'
+
'
from="
'
+
contact_jid
+
'
/other-resource">
'
+
'
<priority>2</priority>
'
+
'
<show>dnd</show>
'
+
'
</presence>
'
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
[
0
]));
expect
(
_converse
.
roster
.
get
(
contact_jid
).
get
(
'
chat_status
'
)).
toBe
(
'
dnd
'
);
expect
(
_
.
keys
(
contact
.
get
(
'
resources
'
)).
length
).
toBe
(
3
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
priority
'
]).
toBe
(
1
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
status
'
]).
toBe
(
'
online
'
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
priority
'
]).
toBe
(
0
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
status
'
]).
toBe
(
'
xa
'
);
expect
(
contact
.
get
(
'
resources
'
)[
'
other-resource
'
][
'
priority
'
]).
toBe
(
2
);
expect
(
contact
.
get
(
'
resources
'
)[
'
other-resource
'
][
'
status
'
]).
toBe
(
'
dnd
'
);
stanza
=
$
(
'
<presence xmlns="jabber:client"
'
+
'
id="tYRdj-35"
'
+
'
to="dummy@localhost/converse.js-21770972"
'
+
'
from="
'
+
contact_jid
+
'
/other-resource">
'
+
'
<priority>3</priority>
'
+
'
<show>away</show>
'
+
'
</presence>
'
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
[
0
]));
expect
(
_converse
.
roster
.
get
(
contact_jid
).
get
(
'
chat_status
'
)).
toBe
(
'
away
'
);
expect
(
_
.
keys
(
contact
.
get
(
'
resources
'
)).
length
).
toBe
(
3
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
priority
'
]).
toBe
(
1
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
status
'
]).
toBe
(
'
online
'
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
priority
'
]).
toBe
(
0
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
status
'
]).
toBe
(
'
xa
'
);
expect
(
contact
.
get
(
'
resources
'
)[
'
other-resource
'
][
'
priority
'
]).
toBe
(
3
);
expect
(
contact
.
get
(
'
resources
'
)[
'
other-resource
'
][
'
status
'
]).
toBe
(
'
away
'
);
stanza
=
$
(
'
<presence xmlns="jabber:client"
'
+
'
to="dummy@localhost/converse.js-21770972"
'
+
'
type="unavailable"
'
+
'
from="
'
+
contact_jid
+
'
/other-resource">
'
+
'
</presence>
'
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
[
0
]));
expect
(
_converse
.
roster
.
get
(
contact_jid
).
get
(
'
chat_status
'
)).
toBe
(
'
online
'
);
expect
(
_
.
keys
(
contact
.
get
(
'
resources
'
)).
length
).
toBe
(
2
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
priority
'
]).
toBe
(
0
);
expect
(
contact
.
get
(
'
resources
'
)[
'
androidkhydmcKW
'
][
'
status
'
]).
toBe
(
'
xa
'
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
priority
'
]).
toBe
(
1
);
expect
(
contact
.
get
(
'
resources
'
)[
'
c71f218b-0797-4732-8a88-b42cb1d8557a
'
][
'
status
'
]).
toBe
(
'
online
'
);
stanza
=
$
(
'
<presence xmlns="jabber:client"
'
+
'
to="dummy@localhost/converse.js-21770972"
'
+
...
...
src/converse-core.js
View file @
7ae2e469
...
...
@@ -887,7 +887,7 @@
*/
var
resources
=
this
.
get
(
'
resources
'
);
if
(
_
.
isObject
(
resources
)
&&
_
.
size
(
resources
))
{
var
val
=
_
(
resources
).
values
().
sortBy
(
'
priority
'
).
get
(
0
);
var
val
=
_
(
resources
).
values
().
sortBy
(
'
priority
'
).
reverse
().
get
(
0
);
if
(
!
_
.
isUndefined
(
val
))
{
return
val
.
status
;
}
...
...
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