mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Fix initial message decryption
This commit is contained in:
parent
0d9673ad3f
commit
02f0a13f2b
@ -17,10 +17,6 @@ export default {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
sent: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {
|
||||
@ -44,7 +40,9 @@ export default {
|
||||
methods: {
|
||||
async decrypt() {
|
||||
try {
|
||||
const counterparty = this.sent ? this.message.recipient : this.message.author
|
||||
const counterparty = this.message.author === this.app.myPubkey
|
||||
? this.message.recipient
|
||||
: this.message.author
|
||||
this.plaintext = await this.app.decryptMessage(counterparty, this.message.content)
|
||||
this.message.cachePlaintext(this.plaintext)
|
||||
} catch (e) {
|
||||
|
@ -158,6 +158,13 @@ export const useNostrStore = defineStore('nostr', {
|
||||
limit: 50,
|
||||
})
|
||||
|
||||
// Fetch our messages once.
|
||||
this.fetch({
|
||||
kinds: [EventKind.DM],
|
||||
authors: [pubkey],
|
||||
limit: 500,
|
||||
})
|
||||
|
||||
const subs = []
|
||||
|
||||
// Subscribe to events created by us.
|
||||
|
@ -11,7 +11,7 @@
|
||||
:sent="message.author === app.myPubkey"
|
||||
:stamp="formatMessageDate(message.createdAt)"
|
||||
>
|
||||
<EncryptedMessage :message="message" :sent="message.author === app.myPubkey" />
|
||||
<EncryptedMessage :message="message" />
|
||||
</q-chat-message>
|
||||
<p v-if="!conversation?.length" class="placeholder">
|
||||
This is the beginning of your message history with <UserName :pubkey="counterparty" clickable />.
|
||||
|
Loading…
Reference in New Issue
Block a user