fix(page-data): deliver MindSpace workspace URLs instead of /u/.../pages/ routes.
Page Data questionnaires were returning publication slugs to users; password-mode pages always fell back to /u/ routes. Prefer MindSpace paths at publish time and rewrite mistaken delivery links in WeChat and Portal chat. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-19
@@ -176,14 +176,12 @@ function resolvePublicationDeliveryPublicUrl({
|
||||
privateToken = null,
|
||||
} = {}) {
|
||||
if (privateToken) return `/s/${privateToken}`;
|
||||
if (accessMode === 'public') {
|
||||
const mindSpaceUrl = resolveWorkspaceMindSpacePublicUrl({
|
||||
h5Root,
|
||||
userId,
|
||||
relativePath: workspaceRelativePath,
|
||||
});
|
||||
if (mindSpaceUrl) return mindSpaceUrl;
|
||||
}
|
||||
const mindSpaceUrl = resolveWorkspaceMindSpacePublicUrl({
|
||||
h5Root,
|
||||
userId,
|
||||
relativePath: workspaceRelativePath,
|
||||
});
|
||||
if (mindSpaceUrl) return mindSpaceUrl;
|
||||
return buildOnlinePublicationPublicUrl(ownerSlug, urlSlug);
|
||||
}
|
||||
|
||||
@@ -1035,17 +1033,16 @@ export function createPublicationService(pool, options = {}) {
|
||||
WHERE id = ?`,
|
||||
[htmlBytes, checksum, publication.asset_version_id],
|
||||
);
|
||||
let publicUrl = publication.public_url;
|
||||
if (publication.access_mode === 'public') {
|
||||
const workspaceRelativePath = resolvePageWorkspaceRelativePath(page);
|
||||
publicUrl = resolvePublicationDeliveryPublicUrl({
|
||||
h5Root,
|
||||
userId,
|
||||
ownerSlug,
|
||||
urlSlug: publication.url_slug,
|
||||
accessMode: publication.access_mode,
|
||||
workspaceRelativePath,
|
||||
});
|
||||
const workspaceRelativePath = resolvePageWorkspaceRelativePath(page);
|
||||
const publicUrl = resolvePublicationDeliveryPublicUrl({
|
||||
h5Root,
|
||||
userId,
|
||||
ownerSlug,
|
||||
urlSlug: publication.url_slug,
|
||||
accessMode: publication.access_mode,
|
||||
workspaceRelativePath,
|
||||
});
|
||||
if (publicUrl !== publication.public_url) {
|
||||
await pool.query(
|
||||
`UPDATE h5_publish_records SET public_url = ?, updated_at = ? WHERE id = ? AND user_id = ?`,
|
||||
[publicUrl, now, publication.id, userId],
|
||||
|
||||
Reference in New Issue
Block a user