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
4295264a
Commit
4295264a
authored
Oct 13, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MAM: Maintain scroll position during upwards infinite scroll
parent
48f119b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
src/converse-chatview.js
src/converse-chatview.js
+8
-2
src/converse-mam-views.js
src/converse-mam-views.js
+1
-0
src/templates/chat_message.js
src/templates/chat_message.js
+3
-0
No files found.
src/converse-chatview.js
View file @
4295264a
...
@@ -363,7 +363,8 @@ export const ChatBoxView = View.extend({
...
@@ -363,7 +363,8 @@ export const ChatBoxView = View.extend({
* - An optional message that serves as the cause for needing to scroll down.
* - An optional message that serves as the cause for needing to scroll down.
*/
*/
maybeScrollDown
(
message
)
{
maybeScrollDown
(
message
)
{
if
(
message
?.
get
(
'
sender
'
)
===
'
me
'
||
!
this
.
model
.
isHidden
())
{
const
new_own_msg
=
!
(
message
?.
get
(
'
is_archived
'
))
&&
message
?.
get
(
'
sender
'
)
===
'
me
'
;
if
((
new_own_msg
||
!
this
.
model
.
get
(
'
scrolled
'
))
&&
!
this
.
model
.
isHidden
())
{
this
.
debouncedScrollDown
();
this
.
debouncedScrollDown
();
}
}
},
},
...
@@ -1001,7 +1002,12 @@ export const ChatBoxView = View.extend({
...
@@ -1001,7 +1002,12 @@ export const ChatBoxView = View.extend({
onScrolledDown
()
{
onScrolledDown
()
{
this
.
hideNewMessagesIndicator
();
this
.
hideNewMessagesIndicator
();
(
!
this
.
model
.
isHidden
())
&&
this
.
model
.
clearUnreadMsgCounter
();
if
(
!
this
.
model
.
isHidden
())
{
this
.
model
.
clearUnreadMsgCounter
();
// Clear location hash if set to one of the messages in our history
const
hash
=
window
.
location
.
hash
;
hash
&&
this
.
model
.
messages
.
get
(
hash
.
slice
(
1
))
&&
_converse
.
router
.
history
.
navigate
();
}
/**
/**
* Triggered once the chat's message area has been scrolled down to the bottom.
* Triggered once the chat's message area has been scrolled down to the bottom.
* @event _converse#chatBoxScrolledDown
* @event _converse#chatBoxScrolledDown
...
...
src/converse-mam-views.js
View file @
4295264a
...
@@ -27,6 +27,7 @@ converse.plugins.add('converse-mam-views', {
...
@@ -27,6 +27,7 @@ converse.plugins.add('converse-mam-views', {
await
view
.
model
.
fetchArchivedMessages
({
'
end
'
:
oldest_message
.
get
(
'
time
'
)});
await
view
.
model
.
fetchArchivedMessages
({
'
end
'
:
oldest_message
.
get
(
'
time
'
)});
}
}
view
.
clearSpinner
();
view
.
clearSpinner
();
_converse
.
router
.
history
.
navigate
(
`#
${
oldest_message
.
get
(
'
msgid
'
)}
`
);
}
}
}
}
});
});
...
...
src/templates/chat_message.js
View file @
4295264a
...
@@ -13,6 +13,9 @@ export default (o) => {
...
@@ -13,6 +13,9 @@ export default (o) => {
data-from="
${
o
.
from
}
"
data-from="
${
o
.
from
}
"
data-encrypted="
${
o
.
is_encrypted
}
">
data-encrypted="
${
o
.
is_encrypted
}
">
<!-- Anchor to allow us to scroll the message into view -->
<a id="
${
o
.
msgid
}
"></a>
${
o
.
shouldShowAvatar
()
?
renderAvatar
(
o
.
getAvatarData
())
:
''
}
${
o
.
shouldShowAvatar
()
?
renderAvatar
(
o
.
getAvatarData
())
:
''
}
<div class="chat-msg__content chat-msg__content--
${
o
.
sender
}
${
o
.
is_me_message
?
'
chat-msg__content--action
'
:
''
}
">
<div class="chat-msg__content chat-msg__content--
${
o
.
sender
}
${
o
.
is_me_message
?
'
chat-msg__content--action
'
:
''
}
">
...
...
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