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
249fb0fe
Commit
249fb0fe
authored
Jun 16, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't increment messages counter for MAM messages.
parent
2c6f6bfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
src/converse-chatview.js
src/converse-chatview.js
+20
-12
No files found.
src/converse-chatview.js
View file @
249fb0fe
...
...
@@ -329,18 +329,29 @@
return
!
this
.
$el
.
is
(
'
:visible
'
);
},
handleTextMessage
:
function
(
message
)
{
this
.
showMessage
(
_
.
clone
(
message
.
attributes
));
if
(
message
.
get
(
'
sender
'
)
!==
'
me
'
)
{
updateNewMessageIndicators
:
function
(
message
)
{
/* We have two indicators of new messages. The unread messages
* counter, which shows the number of unread messages in
* the document.title, and the "new messages" indicator in
* a chat area, if it's scrolled up so that new messages
* aren't visible.
*
* In both cases we ignore MAM messages.
*/
if
(
!
message
.
get
(
'
archive_id
'
))
{
if
(
this
.
model
.
get
(
'
scrolled
'
,
true
))
{
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
removeClass
(
'
hidden
'
);
}
if
(
converse
.
windowState
===
'
blur
'
||
this
.
model
.
get
(
'
scrolled
'
,
true
))
{
converse
.
incrementMsgCounter
();
}
if
(
!
message
.
get
(
'
archive_id
'
)
&&
this
.
model
.
get
(
'
scrolled
'
,
true
))
{
// Show "new messages" indicator if we're scrolled
// up, but only if the new message is not a MAM
// archived one.
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
removeClass
(
'
hidden
'
);
}
},
handleTextMessage
:
function
(
message
)
{
this
.
showMessage
(
_
.
clone
(
message
.
attributes
));
if
(
message
.
get
(
'
sender
'
)
!==
'
me
'
)
{
this
.
updateNewMessageIndicators
(
message
);
}
else
{
// We remove the "scrolled" flag so that the chat area
// gets scrolled down. We always want to scroll down
...
...
@@ -696,9 +707,6 @@
* from what the user is reading when new messages are
* received.
*/
// TODO: need to indicate when new messages are received
// and the user is scrolled away...
// Should probably take a look at incrementMsgCounter
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
var
is_at_bottom
=
this
.
$content
.
scrollTop
()
+
this
.
$content
.
innerHeight
()
>=
this
.
$content
[
0
].
scrollHeight
-
10
;
if
(
is_at_bottom
)
{
...
...
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