Skip to content

Commit

Permalink
Merge pull request #9956 from nextcloud/backport/9895/stable27
Browse files Browse the repository at this point in the history
[stable27] fix(MessagesList) - scroll sticky list to bottom, if reaction was added
  • Loading branch information
Antreesy committed Jul 12, 2023
2 parents ca2bd30 + c542e13 commit 98dd07a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ export default {
showJoinCallButton() {
EventBus.$emit('scroll-chat-to-bottom')
},
// Scroll list to the bottom if reaction to the message was added, as it expands the list
simpleReactions() {
EventBus.$emit('scroll-chat-to-bottom-if-sticky')
},
},
mounted() {
Expand Down
11 changes: 11 additions & 0 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export default {
this.scrollToBottom()
EventBus.$on('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent)
EventBus.$on('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom)
EventBus.$on('scroll-chat-to-bottom-if-sticky', this.scrollToBottomIfSticky)
EventBus.$on('focus-message', this.focusMessage)
EventBus.$on('route-change', this.onRouteChange)
subscribe('networkOffline', this.handleNetworkOffline)
Expand All @@ -300,6 +301,7 @@ export default {
window.removeEventListener('focus', this.onWindowFocus)
EventBus.$off('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent)
EventBus.$off('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom)
EventBus.$on('scroll-chat-to-bottom-if-sticky', this.scrollToBottomIfSticky)
EventBus.$off('focus-message', this.focusMessage)
EventBus.$off('route-change', this.onRouteChange)
Expand Down Expand Up @@ -890,6 +892,15 @@ export default {
}
},
/**
* Scrolls to the bottom of the list (to show reaction to the last message).
*/
scrollToBottomIfSticky() {
if (this.isSticky) {
this.scrollToBottom()
}
},
/**
* Scrolls to the bottom of the list smoothly.
*/
Expand Down

0 comments on commit 98dd07a

Please sign in to comment.