feat: missing slug in editor
This commit is contained in:
parent
be1825fbf7
commit
0fcb1d8ce9
|
|
@ -94,9 +94,10 @@ export const expandCrossbellNote = async ({
|
|||
...new Set(expandedNote.metadata.content.images),
|
||||
]
|
||||
|
||||
if (!disableAutofill) {
|
||||
expandedNote.metadata.content.slug = getNoteSlug(expandedNote)
|
||||
}
|
||||
expandedNote.metadata.content.slug = getNoteSlug(
|
||||
expandedNote,
|
||||
disableAutofill,
|
||||
)
|
||||
if (
|
||||
!expandedNote.metadata.content.date_published &&
|
||||
expandedNote.noteId &&
|
||||
|
|
|
|||
|
|
@ -27,13 +27,11 @@ export const getSiteLink = ({
|
|||
return `${IS_PROD ? "https" : "http"}://${subdomain}.${OUR_DOMAIN}`
|
||||
}
|
||||
|
||||
export const getNoteSlug = (note: NoteEntity) => {
|
||||
export const getNoteSlug = (note: NoteEntity, disableAutofill?: boolean) => {
|
||||
return encodeURIComponent(
|
||||
note.metadata?.content?.attributes?.find(
|
||||
(a) => a?.trait_type === "xlog_slug",
|
||||
)?.value ||
|
||||
note.metadata?.content?.title ||
|
||||
"",
|
||||
)?.value || (disableAutofill ? "" : note.metadata?.content?.title || ""),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue