aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat/chat.js
diff options
context:
space:
mode:
authorSean King <seanking2919@protonmail.com>2022-08-22 19:08:58 -0600
committerSean King <seanking2919@protonmail.com>2022-08-22 19:08:58 -0600
commitee58e3868c2d58b889d8a32c1b6dfd3732df7584 (patch)
treeda8f8783734740df18cb5c1082d4756bfcf47489 /src/components/chat/chat.js
parent325930eecb4943bb50344159646a7c62b4bf10b3 (diff)
parentcb6b96b9ba4e71310e823aecc4bb8c22d370397a (diff)
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into add/edit-status
Diffstat (limited to 'src/components/chat/chat.js')
-rw-r--r--src/components/chat/chat.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js
index 5a5c37b6..79f24771 100644
--- a/src/components/chat/chat.js
+++ b/src/components/chat/chat.js
@@ -57,6 +57,7 @@ const Chat = {
},
unmounted () {
window.removeEventListener('scroll', this.handleScroll)
+ window.removeEventListener('resize', this.handleResize)
if (typeof document.hidden !== 'undefined') document.removeEventListener('visibilitychange', this.handleVisibilityChange, false)
this.$store.dispatch('clearCurrentChat')
},
@@ -135,7 +136,7 @@ const Chat = {
},
// "Sticks" scroll to bottom instead of top, helps with OSK resizing the viewport
handleResize (opts = {}) {
- const { expand = false, delayed = false } = opts
+ const { delayed = false } = opts
if (delayed) {
setTimeout(() => {
@@ -146,10 +147,10 @@ const Chat = {
this.$nextTick(() => {
const { offsetHeight = undefined } = getScrollPosition()
- const diff = this.lastScrollPosition.offsetHeight - offsetHeight
- if (diff !== 0 || (!this.bottomedOut() && expand)) {
+ const diff = offsetHeight - this.lastScrollPosition.offsetHeight
+ if (diff !== 0 && !this.bottomedOut()) {
this.$nextTick(() => {
- window.scrollTo({ top: window.scrollY + diff })
+ window.scrollBy({ top: -Math.trunc(diff) })
})
}
this.lastScrollPosition = getScrollPosition()
@@ -187,6 +188,7 @@ const Chat = {
}, 5000)
},
handleScroll: _.throttle(function () {
+ this.lastScrollPosition = getScrollPosition()
if (!this.currentChat) { return }
if (this.reachedTop()) {