Skip to content

Commit

Permalink
Merge pull request #13579 from nextcloud/backport/13572/stable30
Browse files Browse the repository at this point in the history
  • Loading branch information
Antreesy authored Oct 18, 2024
2 parents 1b39cac + f57fb6b commit 6ca8b16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
:aria-label="t('spreed', 'Scroll to bottom')"
:title="t('spreed', 'Scroll to bottom')"
class="scroll-to-bottom__button"
@click="smoothScrollToBottom">
@click="scrollToBottom">
<template #icon>
<ChevronDoubleDown :size="20" />
</template>
Expand Down Expand Up @@ -198,8 +198,8 @@ export default {
this.$store.dispatch('initialiseUpload', { files, token: this.token, uploadId })
},
smoothScrollToBottom() {
EventBus.emit('scroll-chat-to-bottom', { smooth: true, force: true })
scrollToBottom() {
EventBus.emit('scroll-chat-to-bottom', { smooth: false, force: true })
},
},
Expand Down
18 changes: 9 additions & 9 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default {
stopFetchingOldMessages: false,
isScrolling: false,
isScrolling: null,
stickyDate: null,
Expand Down Expand Up @@ -298,7 +298,7 @@ export default {
}
// scroll to bottom if needed
this.scrollToBottom({ smooth: true })
this.scrollToBottom({ smooth: false })
if (this.conversation?.type === CONVERSATION.TYPE.NOTE_TO_SELF) {
this.$nextTick(() => {
Expand Down Expand Up @@ -639,7 +639,7 @@ export default {
if (!isFocused) {
// Safeguard 2: in case the fallback message is not found too
// scroll to bottom
this.scrollToBottom({ force: true })
this.scrollToBottom({ smooth: false, force: true })
} else {
this.$store.dispatch('setVisualLastReadMessageId', {
token: this.token,
Expand Down Expand Up @@ -856,12 +856,13 @@ export default {
})
},
onScroll() {
onScroll(event) {
// handle scrolling status
if (this.isScrolling) {
clearTimeout(this.endScrollTimeout)
}
this.isScrolling = true
this.isScrolling = this.previousScrollTopValue > event.target.scrollTop ? 'up' : 'down'
this.previousScrollTopValue = event.target.scrollTop
this.endScrollTimeout = setTimeout(this.endScroll, 3000)
// handle sticky date
if (this.$refs.scroller.scrollTop === 0) {
Expand Down Expand Up @@ -909,14 +910,13 @@ export default {
if (Math.abs(scrollOffset - clientHeight) < SCROLL_TOLERANCE && !this.hasMoreMessagesToLoad && scrollTop > 0) {
this.setChatScrolledToBottom(true)
this.displayMessagesLoader = false
this.previousScrollTopValue = scrollTop
this.debounceUpdateReadMarkerPosition()
return
}
this.setChatScrolledToBottom(false)
if ((scrollHeight > clientHeight && scrollTop < 800 && scrollTop < this.previousScrollTopValue)
if ((scrollHeight > clientHeight && scrollTop < 800 && this.isScrolling === 'up')
|| skipHeightCheck) {
if (this.loadingOldMessages || this.isChatBeginningReached) {
// already loading, don't do it twice
Expand All @@ -934,12 +934,12 @@ export default {
this.setChatScrolledToBottom(false, { auto: true })
}
this.previousScrollTopValue = this.$refs.scroller.scrollTop
this.debounceUpdateReadMarkerPosition()
},
endScroll() {
this.isScrolling = false
this.debounceHandleScroll.flush?.()
this.isScrolling = null
clearTimeout(this.endScrollTimeout)
},
Expand Down

0 comments on commit 6ca8b16

Please sign in to comment.