fix: post picture notes
This commit is contained in:
@@ -111,12 +111,12 @@ export async function createPictureNoteDraftEvent(
|
|||||||
): Promise<TDraftEvent> {
|
): Promise<TDraftEvent> {
|
||||||
const { pubkeys, quoteEventIds } = await extractMentions(content)
|
const { pubkeys, quoteEventIds } = await extractMentions(content)
|
||||||
const hashtags = extractHashtags(content)
|
const hashtags = extractHashtags(content)
|
||||||
const { images, contentWithoutImages } = extractImagesFromContent(content)
|
if (!pictureInfos.length) {
|
||||||
if (!images || !images.length) {
|
|
||||||
throw new Error('No images found in content')
|
throw new Error('No images found in content')
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = generateImetaTags(images, pictureInfos)
|
const tags = pictureInfos
|
||||||
|
.map((info) => ['imeta', ...info.tags.map(([n, v]) => `${n} ${v}`)])
|
||||||
.concat(pubkeys.map((pubkey) => ['p', pubkey]))
|
.concat(pubkeys.map((pubkey) => ['p', pubkey]))
|
||||||
.concat(quoteEventIds.map((eventId) => ['q', eventId]))
|
.concat(quoteEventIds.map((eventId) => ['q', eventId]))
|
||||||
.concat(hashtags.map((hashtag) => ['t', hashtag]))
|
.concat(hashtags.map((hashtag) => ['t', hashtag]))
|
||||||
@@ -127,7 +127,7 @@ export async function createPictureNoteDraftEvent(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
kind: PICTURE_EVENT_KIND,
|
kind: PICTURE_EVENT_KIND,
|
||||||
content: contentWithoutImages,
|
content,
|
||||||
tags,
|
tags,
|
||||||
created_at: dayjs().unix()
|
created_at: dayjs().unix()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user