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
f24e7c09
Commit
f24e7c09
authored
Mar 03, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove scrollDownMessageHeight. Fix failing test
parent
0bc0072f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
17 deletions
+15
-17
spec/chatbox.js
spec/chatbox.js
+1
-1
spec/chatroom.js
spec/chatroom.js
+3
-3
src/converse-chatview.js
src/converse-chatview.js
+11
-13
No files found.
spec/chatbox.js
View file @
f24e7c09
...
@@ -699,7 +699,7 @@
...
@@ -699,7 +699,7 @@
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
}
}
});
});
waits
(
50
);
waits
(
50
0
);
// Give enough time for `markScrolled` to have been called
runs
(
function
()
{
runs
(
function
()
{
chatboxview
.
$content
.
scrollTop
(
0
);
chatboxview
.
$content
.
scrollTop
(
0
);
});
});
...
...
spec/chatroom.js
View file @
f24e7c09
...
@@ -1089,8 +1089,8 @@
...
@@ -1089,8 +1089,8 @@
spyOn
(
view
,
'
scrollDown
'
).
andCallThrough
();
spyOn
(
view
,
'
scrollDown
'
).
andCallThrough
();
runs
(
function
()
{
runs
(
function
()
{
/* Create enough messages so that there's a
/* Create enough messages so that there's a
* scrollbar.
* scrollbar.
*/
*/
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
_converse
.
chatboxes
.
onMessage
(
_converse
.
chatboxes
.
onMessage
(
$msg
({
$msg
({
...
@@ -1101,7 +1101,7 @@
...
@@ -1101,7 +1101,7 @@
}).
c
(
'
body
'
).
t
(
'
Message:
'
+
i
).
tree
());
}).
c
(
'
body
'
).
t
(
'
Message:
'
+
i
).
tree
());
}
}
});
});
waits
(
50
);
waits
(
50
0
);
// Give enough time for `markScrolled` to have been called
runs
(
function
()
{
runs
(
function
()
{
view
.
$content
.
scrollTop
(
0
);
view
.
$content
.
scrollTop
(
0
);
});
});
...
...
src/converse-chatview.js
View file @
f24e7c09
...
@@ -221,7 +221,7 @@
...
@@ -221,7 +221,7 @@
insert
.
call
(
that
.
$content
,
$el
);
insert
.
call
(
that
.
$content
,
$el
);
return
$el
;
return
$el
;
},
},
this
.
scrollDown
MessageHeight
.
bind
(
this
)
this
.
scrollDown
.
bind
(
this
)
)(
this
.
renderMessage
(
attrs
));
)(
this
.
renderMessage
(
attrs
));
},
},
...
@@ -288,7 +288,7 @@
...
@@ -288,7 +288,7 @@
this
.
$content
.
find
(
'
.chat-message[data-isodate="
'
+
msg_dates
[
idx
]
+
'
"]
'
));
this
.
$content
.
find
(
'
.chat-message[data-isodate="
'
+
msg_dates
[
idx
]
+
'
"]
'
));
return
$el
;
return
$el
;
}.
bind
(
this
),
}.
bind
(
this
),
this
.
scrollDown
MessageHeight
.
bind
(
this
)
this
.
scrollDown
.
bind
(
this
)
)(
this
.
renderMessage
(
attrs
));
)(
this
.
renderMessage
(
attrs
));
},
},
...
@@ -776,6 +776,13 @@
...
@@ -776,6 +776,13 @@
return
this
;
return
this
;
},
},
hideNewMessagesIndicator
:
function
()
{
var
new_msgs_indicator
=
this
.
el
.
querySelector
(
'
.new-msgs-indicator
'
);
if
(
!
_
.
isNull
(
new_msgs_indicator
))
{
new_msgs_indicator
.
classList
.
add
(
'
hidden
'
);
}
},
markScrolled
:
_
.
debounce
(
function
(
ev
)
{
markScrolled
:
_
.
debounce
(
function
(
ev
)
{
/* Called when the chat content is scrolled up or down.
/* Called when the chat content is scrolled up or down.
* We want to record when the user has scrolled away from
* We want to record when the user has scrolled away from
...
@@ -795,8 +802,8 @@
...
@@ -795,8 +802,8 @@
(
this
.
$content
.
scrollTop
()
+
this
.
$content
.
innerHeight
())
>=
(
this
.
$content
.
scrollTop
()
+
this
.
$content
.
innerHeight
())
>=
this
.
$content
[
0
].
scrollHeight
-
10
;
this
.
$content
[
0
].
scrollHeight
-
10
;
if
(
is_at_bottom
)
{
if
(
is_at_bottom
)
{
this
.
hideNewMessagesIndicator
();
this
.
model
.
save
(
'
scrolled
'
,
false
);
this
.
model
.
save
(
'
scrolled
'
,
false
);
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
addClass
(
'
hidden
'
);
}
else
{
}
else
{
// We're not at the bottom of the chat area, so we mark
// We're not at the bottom of the chat area, so we mark
// that the box is in a scrolled-up state.
// that the box is in a scrolled-up state.
...
@@ -809,20 +816,11 @@
...
@@ -809,20 +816,11 @@
this
.
scrollDown
();
this
.
scrollDown
();
},
},
scrollDownMessageHeight
:
function
(
$message
)
{
if
(
this
.
$content
.
is
(
'
:visible
'
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
this
.
$content
.
scrollTop
(
this
.
$content
.
scrollTop
()
+
$message
[
0
].
scrollHeight
);
this
.
model
.
save
({
'
auto_scrolled
'
:
true
});
}
return
this
;
},
_scrollDown
:
function
()
{
_scrollDown
:
function
()
{
/* Inner method that gets debounced */
/* Inner method that gets debounced */
if
(
this
.
$content
.
is
(
'
:visible
'
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
if
(
this
.
$content
.
is
(
'
:visible
'
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
this
.
$content
.
scrollTop
(
this
.
$content
[
0
].
scrollHeight
);
this
.
$content
.
scrollTop
(
this
.
$content
[
0
].
scrollHeight
);
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
addClass
(
'
hidden
'
);
this
.
hideNewMessagesIndicator
(
);
this
.
model
.
save
({
'
auto_scrolled
'
:
true
});
this
.
model
.
save
({
'
auto_scrolled
'
:
true
});
}
}
},
},
...
...
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