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:
Saumya Pandey
2022-02-10 10:06:10 +05:30
committed by GitHub
parent 9dfd1ec2dd
commit 42061edbd1
21 changed files with 507 additions and 104 deletions

View File

@@ -101,6 +101,23 @@ export async function signIn(
httpOnly: false,
expires,
});
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 [collection, view] = await Promise.all([
Collection.findFirstCollectionForUser(user),
View.findOne({