feat: remove externalUrl

This commit is contained in:
DIYgod
2023-06-14 17:34:16 +01:00
parent 9d462b5797
commit 72bb3f930d
7 changed files with 4 additions and 54 deletions
@@ -211,12 +211,6 @@ export default function SubdomainEditor() {
: { pageId: `${page?.data?.characterId}-${page?.data?.noteId}` }),
isPost: isPost,
published,
externalUrl:
(values.slug || defaultSlug) &&
`${getSiteLink({
subdomain,
domain: site.data?.metadata?.content?.custom_domain,
})}/${encodeURIComponent(values.slug || defaultSlug)}`,
applications: page.data?.metadata?.content?.sources,
characterId: site.data?.characterId,
cover: values.cover,
@@ -10,7 +10,6 @@ import { DashboardMain } from "~/components/dashboard/DashboardMain"
import { ImportPreview } from "~/components/dashboard/ImportPreview"
import { Button } from "~/components/ui/Button"
import { Input } from "~/components/ui/Input"
import { getSiteLink } from "~/lib/helpers"
import { useTranslation } from "~/lib/i18n/client"
import { readFiles } from "~/lib/read-files"
import { usePostNotes } from "~/queries/page"
@@ -57,12 +56,6 @@ export default function ImportMarkdownPage() {
},
],
date_published: file.date_published,
external_urls: [
`${getSiteLink({
subdomain,
domain: site.data?.metadata?.content?.custom_domain,
})}/${encodeURIComponent(file.slug)}`,
],
}
})
setNotes(notes)
@@ -9,7 +9,6 @@ import { toast } from "react-hot-toast"
import { DashboardMain } from "~/components/dashboard/DashboardMain"
import { ImportPreview } from "~/components/dashboard/ImportPreview"
import { Button } from "~/components/ui/Button"
import { getSiteLink } from "~/lib/helpers"
import { useTranslation } from "~/lib/i18n/client"
import { useCheckMirror, useGetMirrorXyz, usePostNotes } from "~/queries/page"
import { useGetSite } from "~/queries/site"
@@ -42,13 +41,7 @@ export default function ImportMarkdownPage() {
},
],
date_published: note.date_published,
external_urls: [
`${getSiteLink({
subdomain,
domain: site.data?.metadata?.content?.custom_domain,
})}/${encodeURIComponent(note.slug)}`,
...note.external_urls,
],
external_urls: [...note.external_urls],
}))
const handleSubmit = form.handleSubmit(async (values) => {
-2
View File
@@ -70,7 +70,6 @@ export const CommentInput = ({
if (values.content) {
updateComment.mutate({
content: values.content,
externalUrl: window.location.href,
characterId: comment.characterId,
noteId: comment.noteId,
originalCharacterId,
@@ -99,7 +98,6 @@ export const CommentInput = ({
characterId,
noteId,
content: values.content,
externalUrl: window.location.href,
originalCharacterId,
originalNoteId,
})
+3 -23
View File
@@ -1,7 +1,7 @@
import { ConnectKitProviderProps } from "@crossbell/connect-kit"
import { CSB_XFEED } from "~/lib/env"
import { getNoteSlug, getSiteLink } from "~/lib/helpers"
import { CSB_XFEED, SITE_URL } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
export const urlComposer: ConnectKitProviderProps["urlComposer"] = {
characterUrl: ({ handle }) => getSiteLink({ subdomain: handle }),
@@ -13,27 +13,7 @@ export const urlComposer: ConnectKitProviderProps["urlComposer"] = {
}
if (originalNote.metadata?.content?.sources?.includes("xlog")) {
if (originalNote.metadata?.content?.external_urls?.[0]) {
return (
originalNote.metadata.content.external_urls[0] +
(originalNote !== note ? `#comments` : "")
)
} else {
const { character } = originalNote
if (character) {
return (
getSiteLink({
subdomain: character.handle,
}) +
"/" +
getNoteSlug(originalNote) +
(originalNote !== note ? `#comments` : "")
)
} else {
return ""
}
}
return `${SITE_URL}/api/redirection?characterId=${originalNote.characterId}&noteId=${originalNote.noteId}`
} else {
return `${CSB_XFEED}/notes/${note.characterId}-${note.noteId}`
}
-5
View File
@@ -56,7 +56,6 @@ export async function createOrUpdatePage(
excerpt?: string
/** Only needed when creating page */
isPost?: boolean
externalUrl?: string
applications?: string[]
cover?: {
address?: string
@@ -93,7 +92,6 @@ export async function createOrUpdatePage(
action: input.pageId ? "update" : "add",
},
{
...(input.externalUrl && { related_urls: [input.externalUrl] }),
...(input.pageId && { id: input.pageId }),
...(input.title && { title: input.title }),
...(input.content && {
@@ -779,12 +777,10 @@ export async function anonymousComment(input: {
export async function updateComment(
{
content,
externalUrl,
characterId,
noteId,
}: {
content: string
externalUrl: string
characterId: number
noteId: number
},
@@ -795,7 +791,6 @@ export async function updateComment(
noteId,
metadata: {
content,
external_urls: [externalUrl],
tags: ["comment"],
sources: ["xlog"],
},
-3
View File
@@ -297,14 +297,12 @@ export function useCommentPage() {
characterId,
noteId,
content,
externalUrl,
originalCharacterId,
originalNoteId,
}: {
characterId: number
noteId: number
content: string
externalUrl: string
originalCharacterId?: number
originalNoteId?: number
}) => {
@@ -316,7 +314,6 @@ export function useCommentPage() {
},
metadata: {
content,
external_urls: [externalUrl],
tags: ["comment"],
sources: ["xlog"],
},