mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Fix rendering of @npub tags
This commit is contained in:
parent
aa8e844ecb
commit
856043bae2
@ -6,7 +6,7 @@
|
|||||||
import BaseMarkdown from 'components/Post/Renderer/BaseMarkdown.vue'
|
import BaseMarkdown from 'components/Post/Renderer/BaseMarkdown.vue'
|
||||||
import {useNostrStore} from 'src/nostr/NostrStore'
|
import {useNostrStore} from 'src/nostr/NostrStore'
|
||||||
import {TagType} from 'src/nostr/model/Event'
|
import {TagType} from 'src/nostr/model/Event'
|
||||||
import {hexToBech32, shortenBech32} from 'src/utils/utils'
|
import {bech32ToHex, hexToBech32, shortenBech32} from 'src/utils/utils'
|
||||||
import routerMixin from 'src/router/mixin'
|
import routerMixin from 'src/router/mixin'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -31,14 +31,6 @@ export default {
|
|||||||
content = this.replaceTagRefs(content)
|
content = this.replaceTagRefs(content)
|
||||||
return content
|
return content
|
||||||
},
|
},
|
||||||
profiles() {
|
|
||||||
const profiles = {}
|
|
||||||
for (const pubkey of this.note.pubkeyRefs()) {
|
|
||||||
// TODO batch request
|
|
||||||
profiles[hexToBech32(pubkey, 'npub')] = this.nostr.getProfile(pubkey)
|
|
||||||
}
|
|
||||||
return profiles
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
replaceTagRefs(str) {
|
replaceTagRefs(str) {
|
||||||
@ -77,7 +69,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
renderProfileRef(bech32) {
|
renderProfileRef(bech32) {
|
||||||
const profile = this.profiles[bech32]
|
const profile = this.nostr.getProfile(bech32ToHex(bech32))
|
||||||
const text = profile
|
const text = profile
|
||||||
? profile.name
|
? profile.name
|
||||||
: shortenBech32(bech32)
|
: shortenBech32(bech32)
|
||||||
|
Loading…
Reference in New Issue
Block a user