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
147e62d0
Commit
147e62d0
authored
Oct 30, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't increment unread msgs counter for <paused> chat state.
Also update release notes. updates #267
parent
0f06902b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
5 deletions
+47
-5
converse.js
converse.js
+10
-5
docs/CHANGES.rst
docs/CHANGES.rst
+1
-0
spec/minchats.js
spec/minchats.js
+36
-0
No files found.
converse.js
View file @
147e62d0
...
...
@@ -909,6 +909,9 @@
if
(
!
body
)
{
if
(
composing
.
length
||
paused
.
length
)
{
// FIXME: use one attribute for chat states (e.g.
// chatstate) instead of saving 'paused' and
// 'composing' separately.
this
.
messages
.
add
({
fullname
:
fullname
,
sender
:
'
them
'
,
...
...
@@ -3043,12 +3046,14 @@
},
initialize
:
function
()
{
this
.
model
.
messages
.
on
(
'
add
'
,
function
(
msg
)
{
if
(
!
msg
.
attributes
.
composing
)
{
this
.
updateUnreadMessagesCounter
();}
}
,
this
);
this
.
model
.
on
(
'
showSentOTRMessage
'
,
this
.
updateUnreadMessagesCounter
,
this
);
this
.
model
.
on
(
'
showReceivedOTRMessage
'
,
this
.
updateUnreadMessagesCounter
,
this
);
this
.
model
.
messages
.
on
(
'
add
'
,
function
(
m
)
{
if
(
!
(
m
.
get
(
'
composing
'
)
||
m
.
get
(
'
paused
'
)))
{
this
.
updateUnreadMessagesCounter
(
);
}
}
,
this
);
this
.
model
.
on
(
'
change:minimized
'
,
this
.
clearUnreadMessagesCounter
,
this
);
this
.
model
.
on
(
'
showReceivedOTRMessage
'
,
this
.
updateUnreadMessagesCounter
,
this
);
this
.
model
.
on
(
'
showSentOTRMessage
'
,
this
.
updateUnreadMessagesCounter
,
this
);
},
render
:
function
()
{
...
...
docs/CHANGES.rst
View file @
147e62d0
...
...
@@ -17,6 +17,7 @@ Changelog
* #151 Browser locks/freezes with many roster users. [jcbrand]
* #251 Non-minified builds for debugging. [jcbrand]
* #264 Remove unnecessary commas for ie8 compatibility. [Deuteu]
* #267 Unread messages counter wrongly gets incremented by chat state notifications. [Deuteu]
0.8.3 (2014-09-22)
------------------
...
...
spec/minchats.js
View file @
147e62d0
...
...
@@ -84,6 +84,42 @@
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
text
()).
toBe
((
i
+
1
).
toString
());
}
// Chat state notifications don't increment the unread messages counter
// <composing> state
this
.
chatboxes
.
onMessage
(
$msg
({
from
:
contact_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
composing
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
text
()).
toBe
((
i
).
toString
());
// <paused> state
this
.
chatboxes
.
onMessage
(
$msg
({
from
:
contact_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
paused
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
text
()).
toBe
((
i
).
toString
());
// <gone> state
this
.
chatboxes
.
onMessage
(
$msg
({
from
:
contact_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
gone
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
text
()).
toBe
((
i
).
toString
());
// <inactive> state
this
.
chatboxes
.
onMessage
(
$msg
({
from
:
contact_jid
,
to
:
this
.
connection
.
jid
,
type
:
'
chat
'
,
id
:
(
new
Date
()).
getTime
()
}).
c
(
'
inactive
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
text
()).
toBe
((
i
).
toString
());
},
converse
));
},
converse
,
mock
,
test_utils
));
...
...
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