Files
Tom Moor 49817d0676 fix: Document and collection mentions on public shares navigate outside the share (#13920)
On a public share, MentionDocument and MentionCollection rendered a Link to
the bare /doc/... or /collection/... path. That route is not part of the
share, so the router fell through to the authenticated app and showed the
login screen. Regular text links to the same documents were unaffected
because they go through the editor's onClickLink handler, which already
prefixes the share route.

Scope mention paths with sharedModelPath when a shareId is in context.
Moves the helper into shared/utils so the editor can use it; the app
wrapper keeps the same signature and reads ROOT_SHARE_ID from env.
2026-10-05 22:23:11 -04:00

32 lines
861 B
TypeScript

export function signin(service = "slack"): string {
return `/auth/${service}`;
}
export function settingsPath(section?: string): string {
return "/settings" + (section ? `/${section}` : "");
}
export function integrationSettingsPath(id: string): string {
return `/settings/integrations/${id}`;
}
/**
* Returns the public path for a shared model.
*
* @param shareId the identifier of the share.
* @param modelPath an optional path to the model within the share.
* @param rootShareId the workspace root share id, if the share is served from "/".
* @returns the path to the shared model.
*/
export function sharedModelPath(
shareId: string,
modelPath?: string,
rootShareId?: string
): string {
if (shareId === rootShareId) {
return modelPath ? modelPath : "/";
}
return modelPath ? `/s/${shareId}${modelPath}` : `/s/${shareId}`;
}