Fix thread navigation

This commit is contained in:
silverpill 2022-09-20 19:44:59 +00:00
parent 158922fcbd
commit 44bbd73b65

View file

@ -26,7 +26,7 @@
title="Go to previous post" title="Go to previous post"
@mouseover="highlight(post.in_reply_to_id)" @mouseover="highlight(post.in_reply_to_id)"
@mouseleave="highlight(null)" @mouseleave="highlight(null)"
@click="navigateTo(post.in_reply_to_id)" @click="navigateTo($event, post.in_reply_to_id)"
> >
<img :src="require('@/assets/tabler/corner-left-up.svg')"> <img :src="require('@/assets/tabler/corner-left-up.svg')">
</a> </a>
@ -40,7 +40,7 @@
<a <a
class="timestamp" class="timestamp"
:href="post.uri" :href="post.uri"
@click="navigateTo($event)" @click="navigateTo($event, post.id)"
> >
{{ humanizeDate(post.created_at) }} {{ humanizeDate(post.created_at) }}
</a> </a>
@ -339,13 +339,12 @@ function highlight(postId: string | null) {
emit("highlight", postId) emit("highlight", postId)
} }
function navigateTo(event: Event) { function navigateTo(event: Event, postId: string) {
if (currentUser === null) { if (currentUser === null) {
// Viewing as guest; do not override click handler // Viewing as guest; do not override click handler
return return
} }
event.preventDefault() event.preventDefault()
const postId = props.post.id
if (props.inThread) { if (props.inThread) {
emit("navigate-to", postId) emit("navigate-to", postId)
} else { } else {