mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
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.
20 lines
653 B
TypeScript
20 lines
653 B
TypeScript
import { sharedModelPath } from "./routeHelpers";
|
|
|
|
describe("#sharedModelPath", () => {
|
|
const shareId = "1c922644-40d8-41fe-98f9-df2b67239d45";
|
|
|
|
it("should prefix the model path with the share route", () => {
|
|
expect(sharedModelPath(shareId)).toBe(`/s/${shareId}`);
|
|
expect(sharedModelPath(shareId, "/doc/test-DjDlkBi77t")).toBe(
|
|
`/s/${shareId}/doc/test-DjDlkBi77t`
|
|
);
|
|
});
|
|
|
|
it("should not prefix when the share is the root share", () => {
|
|
expect(sharedModelPath(shareId, undefined, shareId)).toBe("/");
|
|
expect(sharedModelPath(shareId, "/doc/test-DjDlkBi77t", shareId)).toBe(
|
|
"/doc/test-DjDlkBi77t"
|
|
);
|
|
});
|
|
});
|