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
a050015e
Commit
a050015e
authored
May 30, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add processing hints to chat state notifications
So that they're not stored in MAM.
parent
bd23a775
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
20 deletions
+31
-20
docs/CHANGES.md
docs/CHANGES.md
+2
-1
spec/chatbox.js
spec/chatbox.js
+26
-18
src/converse-chatview.js
src/converse-chatview.js
+3
-1
No files found.
docs/CHANGES.md
View file @
a050015e
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
-
Also indicate new day for the first day's messages. [jcbrand]
-
Also indicate new day for the first day's messages. [jcbrand]
-
Chat bot messages don't appear when they have the same ids as their commands.
-
Chat bot messages don't appear when they have the same ids as their commands.
[jcbrand]
[jcbrand]
-
Updated onDisconnected method to fire disconnected event even if
auto_reconnect is false
. [kamranzafar]
-
Updated onDisconnected method to fire disconnected event even if
`auto_reconnect = false`
. [kamranzafar]
-
#553 Add processing hints to OTR messages [jcbrand]
-
#553 Add processing hints to OTR messages [jcbrand]
-
#553 Add processing hints to chat state notifications [jcbrand]
## 1.0.2 (2016-05-24)
## 1.0.2 (2016-05-24)
...
...
spec/chatbox.js
View file @
a050015e
...
@@ -965,8 +965,10 @@
...
@@ -965,8 +965,10 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
active
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
active
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
});
});
});
});
...
@@ -982,8 +984,10 @@
...
@@ -982,8 +984,10 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
active
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
active
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -1004,8 +1008,9 @@
...
@@ -1004,8 +1008,9 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
composing
'
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
composing
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
// The notification is not sent again
// The notification is not sent again
view
.
keyPressed
({
view
.
keyPressed
({
...
@@ -1035,7 +1040,6 @@
...
@@ -1035,7 +1040,6 @@
expect
(
chatboxview
).
toBeDefined
();
expect
(
chatboxview
).
toBeDefined
();
// Check that the notification appears inside the chatbox in the DOM
// Check that the notification appears inside the chatbox in the DOM
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
expect
(
$events
.
length
).
toBe
(
1
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
is typing
'
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
is typing
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -1059,7 +1063,7 @@
...
@@ -1059,7 +1063,7 @@
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
expect
(
view
.
model
.
get
(
'
chat_state
'
)).
toBe
(
'
composing
'
);
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)
).
toBe
(
'
composing
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
composing
'
);
});
});
waits
(
250
);
waits
(
250
);
runs
(
function
()
{
runs
(
function
()
{
...
@@ -1067,8 +1071,10 @@
...
@@ -1067,8 +1071,10 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
1
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
1
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
paused
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
paused
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
// Test #359. A paused notification should not be sent
// Test #359. A paused notification should not be sent
// out if the user simply types longer than the
// out if the user simply types longer than the
// timeout.
// timeout.
...
@@ -1109,7 +1115,6 @@
...
@@ -1109,7 +1115,6 @@
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
msg
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
msg
);
var
chatboxview
=
this
.
chatboxviews
.
get
(
sender_jid
);
var
chatboxview
=
this
.
chatboxviews
.
get
(
sender_jid
);
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
expect
(
$events
.
length
).
toBe
(
1
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
has stopped typing
'
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
has stopped typing
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -1141,8 +1146,11 @@
...
@@ -1141,8 +1146,11 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
inactive
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
inactive
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
});
});
}.
bind
(
converse
));
}.
bind
(
converse
));
...
@@ -1156,8 +1164,7 @@
...
@@ -1156,8 +1164,7 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
inactive
'
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
inactive
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
it
(
"
is sent if the user closes a chat box
"
,
function
()
{
it
(
"
is sent if the user closes a chat box
"
,
function
()
{
...
@@ -1173,8 +1180,10 @@
...
@@ -1173,8 +1180,10 @@
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
attr
(
'
to
'
)).
toBe
(
contact_jid
);
expect
(
$stanza
.
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
().
prop
(
'
tagName
'
)).
toBe
(
'
inactive
'
);
expect
(
$stanza
.
children
().
get
(
0
).
tagName
).
toBe
(
'
inactive
'
);
expect
(
$stanza
.
children
().
get
(
1
).
tagName
).
toBe
(
'
no-store
'
);
expect
(
$stanza
.
children
().
get
(
2
).
tagName
).
toBe
(
'
no-permanent-store
'
);
});
});
});
});
...
@@ -1215,7 +1224,6 @@
...
@@ -1215,7 +1224,6 @@
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
msg
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
msg
);
var
chatboxview
=
this
.
chatboxviews
.
get
(
sender_jid
);
var
chatboxview
=
this
.
chatboxviews
.
get
(
sender_jid
);
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
expect
(
$events
.
length
).
toBe
(
1
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
has gone away
'
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
has gone away
'
);
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
...
...
src/converse-chatview.js
View file @
a050015e
...
@@ -447,7 +447,9 @@
...
@@ -447,7 +447,9 @@
*/
*/
converse
.
connection
.
send
(
converse
.
connection
.
send
(
$msg
({
'
to
'
:
this
.
model
.
get
(
'
jid
'
),
'
type
'
:
'
chat
'
})
$msg
({
'
to
'
:
this
.
model
.
get
(
'
jid
'
),
'
type
'
:
'
chat
'
})
.
c
(
this
.
model
.
get
(
'
chat_state
'
),
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
})
.
c
(
this
.
model
.
get
(
'
chat_state
'
),
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
up
()
.
c
(
'
no-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
}).
up
()
.
c
(
'
no-permanent-store
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
HINTS
})
);
);
},
},
...
...
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