FIX - open SMS threads at latest message

This commit is contained in:
smx.pusha
2026-08-12 07:56:05 +02:00
parent 0053cfbdb1
commit 5cbd9864d1
2 changed files with 14 additions and 5 deletions
+5
View File
@@ -4666,6 +4666,11 @@ button {
min-height: calc(100% - 12px);
padding: 10px 12px 20px;
}
.messages-thread-bottom {
display: block;
width: 100%;
height: 1px;
}
.messages-bubbles [class*='message-bubble'] {
max-width: 248px;
border-radius: 21px;
+9 -5
View File
@@ -103,6 +103,7 @@ const gifNextOffset = ref(0)
const recording = ref(false)
const recordingElapsedMs = ref(0)
const recordingLevels = ref<number[]>(Array(32).fill(0.16))
const threadBottom = ref<HTMLElement | null>(null)
let toastTimer: ReturnType<typeof setTimeout> | undefined
let gifSearchTimer: ReturnType<typeof setTimeout> | undefined
let recordingTimer: ReturnType<typeof setInterval> | undefined
@@ -329,11 +330,12 @@ function errorText(error?: string): string {
async function scrollToBottom(animate = true): Promise<void> {
await nextTick()
const page = document.querySelector<HTMLElement>('.messages-thread-page')
if (!page) return
page.scrollTo({
await new Promise<void>((resolve) => {
requestAnimationFrame(() => resolve())
})
threadBottom.value?.scrollIntoView({
block: 'end',
behavior: animate ? 'smooth' : 'auto',
top: page.scrollHeight,
})
}
@@ -827,11 +829,12 @@ onMounted(async () => {
if (messages.activeNumber) {
const media = messageMedia.consume(messages.activeNumber)
if (media) {
void sendAttachment(
await sendAttachment(
media.mediaType === 'photo' ? 'image' : 'video',
import.meta.env.DEV ? media.url : String(media.id),
)
}
await scrollToBottom(false)
}
})
@@ -1315,6 +1318,7 @@ onBeforeUnmount(() => {
</k-message>
</template>
</k-messages>
<span ref="threadBottom" class="messages-thread-bottom" aria-hidden="true" />
<section
v-if="activeCanMessage && attachmentMenuOpen"