diff --git a/src/components/Message/EncryptedMessage.vue b/src/components/Message/EncryptedMessage.vue index 28b69ac..396c669 100644 --- a/src/components/Message/EncryptedMessage.vue +++ b/src/components/Message/EncryptedMessage.vue @@ -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) { diff --git a/src/nostr/NostrStore.js b/src/nostr/NostrStore.js index 768e096..7c605ee 100644 --- a/src/nostr/NostrStore.js +++ b/src/nostr/NostrStore.js @@ -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. diff --git a/src/pages/messages/Conversation.vue b/src/pages/messages/Conversation.vue index 58890a2..cc44042 100644 --- a/src/pages/messages/Conversation.vue +++ b/src/pages/messages/Conversation.vue @@ -11,7 +11,7 @@ :sent="message.author === app.myPubkey" :stamp="formatMessageDate(message.createdAt)" > - +

This is the beginning of your message history with .