fix: Users not mentionable when not in seamless editing mode

This commit is contained in:
Tom Moor
2023-03-28 22:32:35 -04:00
parent 7ba6a9379b
commit a2f1f059c7
3 changed files with 17 additions and 9 deletions

View File

@@ -7,6 +7,14 @@ describe("#parseDocumentSlug", () => {
).toEqual("my-doc-y4j4tR4UuV");
});
it("should work with paths after document slug", () => {
expect(
parseDocumentSlug(
"http://mywiki.getoutline.com/doc/my-doc-y4j4tR4UuV/edit"
)
).toEqual("my-doc-y4j4tR4UuV");
});
it("should work with subdomain qualified url", () => {
expect(
parseDocumentSlug("http://mywiki.getoutline.com/doc/my-doc-y4j4tR4UuV")

View File

@@ -17,7 +17,7 @@ export default function parseDocumentSlug(url: string) {
}
}
return parsed.lastIndexOf("/doc/") === 0
? parsed.replace(/^\/doc\//, "").split("#")[0]
: undefined;
const split = parsed.split("/");
const indexOfDoc = split.indexOf("doc");
return split[indexOfDoc + 1] ?? undefined;
}