mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
* Fix conversation scroll behaviour
* Don't show unreads for own messages
This commit is contained in:
parent
d82f0fdfdb
commit
a6adc94c1c
@ -17,7 +17,7 @@ export const useMessageStore = defineStore('message', {
|
||||
const messages = this.getMessages(pubkey, counterparty)
|
||||
const latestMessage = messages.reduce((a, b) => a.createdAt > b.createdAt ? a : b, {createdAt: 0})
|
||||
const lastRead = useMessageStatusStore().getLastRead(pubkey, counterparty)
|
||||
const numUnread = messages.filter(msg => msg.createdAt > lastRead).length
|
||||
const numUnread = messages.filter(msg => msg.createdAt > lastRead && msg.author === counterparty).length
|
||||
conversations.push({
|
||||
pubkey: counterparty,
|
||||
latestMessage,
|
||||
|
@ -3,7 +3,7 @@
|
||||
<UserCard :pubkey="counterparty" class="conversation-header" clickable />
|
||||
</PageHeader>
|
||||
|
||||
<div class="conversation">
|
||||
<div ref="conversation" class="conversation">
|
||||
<div class="pusher"></div>
|
||||
<ChatMessage
|
||||
v-for="message in conversation"
|
||||
@ -75,7 +75,12 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.markAsRead()
|
||||
setTimeout(() => this.scrollToBottom(), 100)
|
||||
|
||||
this.resizeObserver = new ResizeObserver(this.scrollToBottom.bind(this))
|
||||
this.resizeObserver.observe(this.$refs.conversation)
|
||||
},
|
||||
unmounted() {
|
||||
this.resizeObserver.disconnect()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -128,7 +133,7 @@ export default {
|
||||
|
||||
@media screen and (max-width: $phone) {
|
||||
.conversation {
|
||||
padding-bottom: 48px;
|
||||
padding-bottom: 62px;
|
||||
}
|
||||
.conversation-reply {
|
||||
width: 100%;
|
||||
|
Loading…
Reference in New Issue
Block a user