diff --git a/app.vue b/app.vue index 62bd208..6d41bab 100644 --- a/app.vue +++ b/app.vue @@ -26,8 +26,6 @@ await indexedDBStore.startup(); const isLoggedIn = ref(isUserLoggedIn()); -console.error(isLoggedIn.value); - const store = useStore(); store.state.loaded = false; diff --git a/components/input/FvMessageSender.vue b/components/input/FvMessageSender.vue index 651828d..8b6dff0 100644 --- a/components/input/FvMessageSender.vue +++ b/components/input/FvMessageSender.vue @@ -1,7 +1,7 @@ diff --git a/components/login/Login.vue b/components/login/Login.vue index 70e6f65..9c31423 100644 --- a/components/login/Login.vue +++ b/components/login/Login.vue @@ -66,6 +66,7 @@ const submit = async (e: Event) => { }; flowStage.value = FlowStage.Login; + error.value = null; loading.value = false; } else if (flowStage.value === FlowStage.Login) { if (!homeserverData.value) return; diff --git a/components/messages/FvMessage.vue b/components/messages/FvMessage.vue index 8dd7455..92fd28a 100644 --- a/components/messages/FvMessage.vue +++ b/components/messages/FvMessage.vue @@ -59,7 +59,7 @@ const reply = room.room.findEventById(event.value.event.replyEventId ?? ""); const log = console.error; -const body: string = props.message.getContent().body; +const body: string = props.message.getContent().body ?? ""; const bodyHtml = document.createElement("div"); const replyBody = document.createElement("div"); @@ -108,6 +108,21 @@ const setReply = () => { text: "", }; }; + +// Mark as read on visible +const messageRef = ref(null); +useIntersectionObserver(messageRef, ([{ isIntersecting }]) => { + if (isIntersecting) { + if ( + !room.room.hasUserReadEvent( + store.client?.getUserId() ?? "", + event.value.event.getId() ?? "" + ) + ) { + store.client?.sendReadReceipt(event.value.event as MatrixEvent); + } + } +});