mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
chore: Remove collection.url, fix post-signin redirect (#11139)
This commit is contained in:
@@ -72,7 +72,7 @@ export default class SlackProcessor extends BaseProcessor {
|
||||
{
|
||||
color: collection.color,
|
||||
title: collection.name,
|
||||
title_link: `${env.URL}${collection.url}`,
|
||||
title_link: `${env.URL}${collection.path}`,
|
||||
text: collection.description,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("shareLoader", () => {
|
||||
expect(result.share.id).toEqual(share.id);
|
||||
expect(result.collection?.id).toEqual(collection.id);
|
||||
expect(result.sharedTree?.id).toEqual(collection.id);
|
||||
expect(result.sharedTree?.url).toEqual(collection.url);
|
||||
expect(result.sharedTree?.url).toEqual(collection.path);
|
||||
expect(result.sharedTree?.children[0].id).toEqual(document.id);
|
||||
expect(result.sharedTree?.children[0].children[0].id).toEqual(
|
||||
childDocument.id
|
||||
|
||||
@@ -73,13 +73,13 @@ ${collection.name}
|
||||
|
||||
${collection.user.name} created the collection "${collection.name}"
|
||||
|
||||
Open Collection: ${teamUrl}${collection.url}
|
||||
Open Collection: ${teamUrl}${collection.path}
|
||||
`;
|
||||
}
|
||||
|
||||
protected render(props: Props) {
|
||||
const { collection, teamUrl, unsubscribeUrl } = props;
|
||||
const collectionLink = `${teamUrl}${collection.url}`;
|
||||
const collectionLink = `${teamUrl}${collection.path}`;
|
||||
|
||||
return (
|
||||
<EmailTemplate
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("#url", () => {
|
||||
const collection = new Collection({
|
||||
id: "1234",
|
||||
});
|
||||
expect(collection.url).toBe(`/collection/untitled-${collection.urlId}`);
|
||||
expect(collection.path).toBe(`/collection/untitled-${collection.urlId}`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -315,15 +315,6 @@ class Collection extends ParanoidModel<
|
||||
|
||||
// getters
|
||||
|
||||
/**
|
||||
* The frontend path to this collection.
|
||||
*
|
||||
* @deprecated Use `path` instead.
|
||||
*/
|
||||
get url(): string {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
/** The frontend path to this collection. */
|
||||
get path(): string {
|
||||
if (!this.name) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export default async function presentCollection(
|
||||
|
||||
const res: Record<string, any> = {
|
||||
id: collection.id,
|
||||
url: collection.url,
|
||||
url: collection.path,
|
||||
urlId: collection.urlId,
|
||||
name: collection.name,
|
||||
data: asData
|
||||
|
||||
@@ -30,7 +30,7 @@ describe("auth/redirect", () => {
|
||||
);
|
||||
expect(res.status).toEqual(302);
|
||||
expect(res.headers.get("location")).not.toBeNull();
|
||||
expect(res.headers.get("location")!.endsWith(collection.url)).toBeTruthy();
|
||||
expect(res.headers.get("location")!.endsWith(collection.path)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should prevent token extension by rejecting JWT tokens", async () => {
|
||||
|
||||
@@ -66,7 +66,7 @@ router.get("/redirect", authMiddleware(), async (ctx: APIContext) => {
|
||||
});
|
||||
|
||||
if (collection) {
|
||||
ctx.redirect(`${team.url}${collection.url}`);
|
||||
ctx.redirect(`${team.url}${collection.path}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ router.get("/redirect", authMiddleware(), async (ctx: APIContext) => {
|
||||
|
||||
ctx.redirect(
|
||||
!hasViewedDocuments && collection
|
||||
? `${team?.url}${collection.url}`
|
||||
? `${team?.url}${collection.path}/recent`
|
||||
: `${team?.url}/home`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -151,7 +151,7 @@ export async function signIn(
|
||||
});
|
||||
|
||||
if (collection) {
|
||||
ctx.redirect(`${team.url}${collection.url}`);
|
||||
ctx.redirect(`${team.url}${collection.path}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ export async function signIn(
|
||||
|
||||
ctx.redirect(
|
||||
!hasViewedDocuments && collection
|
||||
? `${team.url}${collection.url}`
|
||||
? `${team.url}${collection.path}/recent`
|
||||
: `${team.url}/home`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user