feat: add the ability to choose default collection (#3029)
Co-authored-by: Tom Moor <tom@getoutline.com> Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -42,12 +42,29 @@ router.get("/redirect", auth(), async (ctx) => {
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
const defaultCollectionId = team?.defaultCollectionId;
|
||||
|
||||
if (defaultCollectionId) {
|
||||
const collection = await Collection.findOne({
|
||||
where: {
|
||||
id: defaultCollectionId,
|
||||
teamId: team.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (collection) {
|
||||
ctx.redirect(`${team.url}${collection.url}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const hasViewedDocuments = !!view;
|
||||
|
||||
ctx.redirect(
|
||||
!hasViewedDocuments && collection
|
||||
? `${team!.url}${collection.url}`
|
||||
: `${team!.url}/home`
|
||||
? `${team?.url}${collection.url}`
|
||||
: `${team?.url}/home`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user