fix: chat accepts quotes now
This commit is contained in:
@@ -38,8 +38,7 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import type { Post } from "@/lib/social";
|
||||
import { createShortLink } from "@/lib/share";
|
||||
import { structuredReferenceForPost } from "@/lib/source-reference";
|
||||
import { buildPostShareText } from "@/lib/post-share-text";
|
||||
import { useAuth } from "@/components/auth/auth-provider";
|
||||
import { useMediaQuery } from "@/components/selection-toolbar/shared";
|
||||
import { SharePostSheet } from "./share-post-sheet";
|
||||
@@ -131,30 +130,17 @@ export function SharePostProvider({
|
||||
// it.
|
||||
// 3. On any non-AbortError, fall back to the custom sheet.
|
||||
try {
|
||||
const longPath = `/u/${encodeURIComponent(handle)}/posts#post-${post.id}`;
|
||||
const hasImage = !!post.images?.[0];
|
||||
const [code, imageFile] = await Promise.all([
|
||||
createShortLink(longPath),
|
||||
const [share, imageFile] = await Promise.all([
|
||||
buildPostShareText(post, handle),
|
||||
hasImage ? fetchShareImageFile(post.id) : Promise.resolve(null),
|
||||
]);
|
||||
const origin = window.location.origin;
|
||||
const url = code
|
||||
? new URL(`/share/${code}`, origin).toString()
|
||||
: new URL(longPath, origin).toString();
|
||||
if (!share) {
|
||||
setActivePost(post);
|
||||
return;
|
||||
}
|
||||
|
||||
const ref = structuredReferenceForPost(
|
||||
post.source_url,
|
||||
post.source_title,
|
||||
);
|
||||
const lines = [`“${post.caption}”`, "", "Source:", ref.title];
|
||||
if (ref.detail) lines.push(ref.detail);
|
||||
lines.push(url);
|
||||
const text = lines.join("\n");
|
||||
const title = ref.detail
|
||||
? `${ref.title} — ${ref.detail}`
|
||||
: ref.title;
|
||||
|
||||
const payload: ShareData = { title, text };
|
||||
const payload: ShareData = { title: share.title, text: share.text };
|
||||
// Only attach files when the platform actually accepts them.
|
||||
// canShare returns false on Chrome desktop / Firefox even
|
||||
// though navigator.share itself exists, and we want to fail
|
||||
|
||||
Reference in New Issue
Block a user