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
c976f3f0
Commit
c976f3f0
authored
Mar 16, 2017
by
Soumit Bose
Committed by
JC Brand
Mar 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed typing status for typing from different devices (#802)
parent
24b39b3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
3 deletions
+88
-3
docs/CHANGES.md
docs/CHANGES.md
+2
-1
spec/chatbox.js
spec/chatbox.js
+74
-0
src/converse-chatview.js
src/converse-chatview.js
+12
-2
No files found.
docs/CHANGES.md
View file @
c976f3f0
...
...
@@ -4,7 +4,8 @@
-
#585 Duplicate contact created due to JID case sensivity [saganshul]
-
#628 Fixes the bug in displaying chat status during private chat. [saganshul]
-
#797 Time format made configurable. [smitbose]
-
#628 Changes the message displayed while typing from a different resource of the same user. [smitbose]
-
#675 Time format made configurable. [smitbose]
-
#806 The
`_converse.listen`
API event listeners aren't triggered. [jcbrand]
-
#807 Error: Plugin "converse-dragresize" tried to override HeadlinesBoxView but it's not found. [jcbrand]
...
...
spec/chatbox.js
View file @
c976f3f0
...
...
@@ -1393,6 +1393,43 @@
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
is typing
'
);
}));
it
(
"
can be a composing carbon message that this user sent from a different client
"
,
mock
.
initConverse
(
function
(
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// Send a message from a different resource
spyOn
(
_converse
,
'
log
'
);
var
recipient_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
recipient_jid
);
var
msg
=
$msg
({
'
from
'
:
_converse
.
bare_jid
,
'
id
'
:
(
new
Date
()).
getTime
(),
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
chat
'
,
'
xmlns
'
:
'
jabber:client
'
}).
c
(
'
sent
'
,
{
'
xmlns
'
:
'
urn:xmpp:carbons:2
'
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
.
c
(
'
message
'
,
{
'
xmlns
'
:
'
jabber:client
'
,
'
from
'
:
_converse
.
bare_jid
+
'
/another-resource
'
,
'
to
'
:
recipient_jid
,
'
type
'
:
'
chat
'
}).
c
(
'
composing
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
// Check that the chatbox and its view now exist
var
chatbox
=
_converse
.
chatboxes
.
get
(
recipient_jid
);
var
chatboxview
=
_converse
.
chatboxviews
.
get
(
recipient_jid
);
// Check that the message was received and check the message parameters
expect
(
chatbox
.
messages
.
length
).
toEqual
(
1
);
var
msg_obj
=
chatbox
.
messages
.
models
[
0
];
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
_converse
.
xmppstatus
.
get
(
'
fullname
'
));
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
me
'
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
status_text
=
$chat_content
.
find
(
'
.chat-info.chat-event
'
).
text
();
expect
(
status_text
).
toBe
(
'
Typing from another device
'
);
}));
});
describe
(
"
A paused notification
"
,
function
()
{
...
...
@@ -1477,6 +1514,43 @@
var
$events
=
chatboxview
.
$el
.
find
(
'
.chat-event
'
);
expect
(
$events
.
text
()).
toEqual
(
mock
.
cur_names
[
1
]
+
'
has stopped typing
'
);
}));
it
(
"
can be a paused carbon message that this user sent from a different client
"
,
mock
.
initConverse
(
function
(
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// Send a message from a different resource
spyOn
(
_converse
,
'
log
'
);
var
recipient_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
recipient_jid
);
var
msg
=
$msg
({
'
from
'
:
_converse
.
bare_jid
,
'
id
'
:
(
new
Date
()).
getTime
(),
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
chat
'
,
'
xmlns
'
:
'
jabber:client
'
}).
c
(
'
sent
'
,
{
'
xmlns
'
:
'
urn:xmpp:carbons:2
'
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
.
c
(
'
message
'
,
{
'
xmlns
'
:
'
jabber:client
'
,
'
from
'
:
_converse
.
bare_jid
+
'
/another-resource
'
,
'
to
'
:
recipient_jid
,
'
type
'
:
'
chat
'
}).
c
(
'
paused
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
tree
();
_converse
.
chatboxes
.
onMessage
(
msg
);
// Check that the chatbox and its view now exist
var
chatbox
=
_converse
.
chatboxes
.
get
(
recipient_jid
);
var
chatboxview
=
_converse
.
chatboxviews
.
get
(
recipient_jid
);
// Check that the message was received and check the message parameters
expect
(
chatbox
.
messages
.
length
).
toEqual
(
1
);
var
msg_obj
=
chatbox
.
messages
.
models
[
0
];
expect
(
msg_obj
.
get
(
'
fullname
'
)).
toEqual
(
_converse
.
xmppstatus
.
get
(
'
fullname
'
));
expect
(
msg_obj
.
get
(
'
sender
'
)).
toEqual
(
'
me
'
);
expect
(
msg_obj
.
get
(
'
delayed
'
)).
toEqual
(
false
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
status_text
=
$chat_content
.
find
(
'
.chat-info.chat-event
'
).
text
();
expect
(
status_text
).
toBe
(
'
Stopped typing on the other device
'
);
}));
});
describe
(
"
An inactive notifciation
"
,
function
()
{
...
...
src/converse-chatview.js
View file @
c976f3f0
...
...
@@ -376,10 +376,20 @@
handleChatStateMessage
:
function
(
message
)
{
if
(
message
.
get
(
'
chat_state
'
)
===
_converse
.
COMPOSING
)
{
this
.
showStatusNotification
(
message
.
get
(
'
fullname
'
)
+
'
'
+
__
(
'
is typing
'
));
if
(
message
.
get
(
'
sender
'
)
===
'
me
'
)
{
this
.
showStatusNotification
(
__
(
'
Typing from another device
'
));
}
else
{
this
.
showStatusNotification
(
message
.
get
(
'
fullname
'
)
+
'
'
+
__
(
'
is typing
'
));
}
this
.
clear_status_timeout
=
window
.
setTimeout
(
this
.
clearStatusNotification
.
bind
(
this
),
30000
);
}
else
if
(
message
.
get
(
'
chat_state
'
)
===
_converse
.
PAUSED
)
{
this
.
showStatusNotification
(
message
.
get
(
'
fullname
'
)
+
'
'
+
__
(
'
has stopped typing
'
));
if
(
message
.
get
(
'
sender
'
)
===
'
me
'
)
{
this
.
showStatusNotification
(
__
(
'
Stopped typing on the other device
'
));
}
else
{
this
.
showStatusNotification
(
message
.
get
(
'
fullname
'
)
+
'
'
+
__
(
'
has stopped typing
'
));
}
}
else
if
(
_
.
includes
([
_converse
.
INACTIVE
,
_converse
.
ACTIVE
],
message
.
get
(
'
chat_state
'
)))
{
this
.
$content
.
find
(
'
div.chat-event
'
).
remove
();
}
else
if
(
message
.
get
(
'
chat_state
'
)
===
_converse
.
GONE
)
{
...
...
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