diff --git a/server/commands/accountProvisioner.ts b/server/commands/accountProvisioner.ts index 5668265939..2817cccbb2 100644 --- a/server/commands/accountProvisioner.ts +++ b/server/commands/accountProvisioner.ts @@ -101,7 +101,7 @@ async function accountProvisioner({ // The account could not be provisioned for the provided teamId // check to see if we can try authentication using email matching only if (err.id === "invalid_authentication") { - const authenticationProvider = await AuthenticationProvider.findOne({ + const authProvider = await AuthenticationProvider.findOne({ where: { name: authenticationProviderParams.name, teamId: teamParams.teamId, @@ -116,11 +116,11 @@ async function accountProvisioner({ order: [["enabled", "DESC"]], }); - if (authenticationProvider) { + if (authProvider) { emailMatchOnly = true; result = { - authenticationProvider, - team: authenticationProvider.team, + authenticationProvider: authProvider, + team: authProvider.team, isNewTeam: false, }; } diff --git a/server/commands/documentDuplicator.ts b/server/commands/documentDuplicator.ts index da542a2f94..d82e003aa6 100644 --- a/server/commands/documentDuplicator.ts +++ b/server/commands/documentDuplicator.ts @@ -60,7 +60,7 @@ export default async function documentDuplicator({ async function duplicateChildDocuments( original: Document, - duplicated: Document + duplicatedDocument: Document ) { const childDocuments = await original.findChildDocuments( { @@ -77,7 +77,7 @@ export default async function documentDuplicator({ for (const childDocument of childDocuments) { const duplicatedChildDocument = await documentCreator({ - parentDocumentId: duplicated.id, + parentDocumentId: duplicatedDocument.id, icon: childDocument.icon, color: childDocument.color, title: childDocument.title, diff --git a/server/commands/documentMover.ts b/server/commands/documentMover.ts index f09f6c361d..09501c13da 100644 --- a/server/commands/documentMover.ts +++ b/server/commands/documentMover.ts @@ -193,11 +193,11 @@ async function documentMover({ document.collection = newCollection; result.documents.push( - ...documents.map((document) => { + ...documents.map((doc) => { if (newCollection) { - document.collection = newCollection; + doc.collection = newCollection; } - return document; + return doc; }) ); diff --git a/server/commands/teamProvisioner.test.ts b/server/commands/teamProvisioner.test.ts index c60716cb7e..81ce331e95 100644 --- a/server/commands/teamProvisioner.test.ts +++ b/server/commands/teamProvisioner.test.ts @@ -110,14 +110,14 @@ describe("teamProvisioner", () => { let error; try { - const subdomain = faker.internet.domainWord(); + const testSubdomain = faker.internet.domainWord(); await teamProvisioner({ teamId: exampleTeam.id, name: "name", - subdomain, + subdomain: testSubdomain, authenticationProvider: { name: "google", - providerId: `${subdomain}.com`, + providerId: `${testSubdomain}.com`, }, ip, }); diff --git a/server/commands/teamProvisioner.ts b/server/commands/teamProvisioner.ts index 380d090656..dca325d802 100644 --- a/server/commands/teamProvisioner.ts +++ b/server/commands/teamProvisioner.ts @@ -83,7 +83,7 @@ async function teamProvisioner({ } // This team + auth provider combination has not been seen before in self hosted - const team = await Team.findByPk(teamId, { + const existingTeam = await Team.findByPk(teamId, { rejectOnEmpty: true, }); @@ -91,14 +91,14 @@ async function teamProvisioner({ // new team is allowed then assign the authentication provider to the // existing team if (domain) { - if (await team.isDomainAllowed(domain)) { - authP = await team.$create( + if (await existingTeam.isDomainAllowed(domain)) { + authP = await existingTeam.$create( "authenticationProvider", authenticationProvider ); return { authenticationProvider: authP, - team, + team: existingTeam, isNewTeam: false, }; } diff --git a/server/commands/userInviter.ts b/server/commands/userInviter.ts index 6b811cd7c9..b192549402 100644 --- a/server/commands/userInviter.ts +++ b/server/commands/userInviter.ts @@ -46,7 +46,9 @@ export default async function userInviter({ email: emails, }, }); - const existingEmails = existingUsers.map((user) => user.email); + const existingEmails = existingUsers.map( + (existingUser) => existingUser.email + ); const filteredInvites = normalizedInvites.filter( (invite) => !existingEmails.includes(invite.email) ); diff --git a/server/commands/userProvisioner.ts b/server/commands/userProvisioner.ts index 8d11004ece..59e11262eb 100644 --- a/server/commands/userProvisioner.ts +++ b/server/commands/userProvisioner.ts @@ -136,7 +136,7 @@ export default async function userProvisioner({ // that's never been active before. const isInvite = existingUser.isInvited; - const auth = await sequelize.transaction(async (transaction) => { + const userAuth = await sequelize.transaction(async (transaction) => { if (isInvite) { await Event.create( { @@ -198,7 +198,7 @@ export default async function userProvisioner({ return { user: existingUser, - authentication: auth, + authentication: userAuth, isNewUser: isInvite, }; } else if (!authentication && !team?.allowedDomains.length) { diff --git a/server/emails/templates/BaseEmail.tsx b/server/emails/templates/BaseEmail.tsx index b81aa5ced9..7021ef0fc2 100644 --- a/server/emails/templates/BaseEmail.tsx +++ b/server/emails/templates/BaseEmail.tsx @@ -35,7 +35,7 @@ export interface EmailProps { export default abstract class BaseEmail< T extends EmailProps, - S extends Record | void = void + S extends Record | void = void > { private props: T; private metadata?: NotificationMetadata; diff --git a/server/emails/templates/InviteEmail.tsx b/server/emails/templates/InviteEmail.tsx index fd173bfe19..6815c82259 100644 --- a/server/emails/templates/InviteEmail.tsx +++ b/server/emails/templates/InviteEmail.tsx @@ -21,7 +21,7 @@ type Props = EmailProps & { /** * Email sent to an external user when an admin sends them an invite. */ -export default class InviteEmail extends BaseEmail> { +export default class InviteEmail extends BaseEmail { protected get category() { return EmailMessageCategory.Invitation; } diff --git a/server/emails/templates/SigninEmail.tsx b/server/emails/templates/SigninEmail.tsx index bb229118df..dc87a3ae2c 100644 --- a/server/emails/templates/SigninEmail.tsx +++ b/server/emails/templates/SigninEmail.tsx @@ -20,7 +20,7 @@ type Props = EmailProps & { /** * Email sent to a user when they request a magic sign-in link. */ -export default class SigninEmail extends BaseEmail> { +export default class SigninEmail extends BaseEmail { protected get category() { return EmailMessageCategory.Authentication; } diff --git a/server/logging/Logger.ts b/server/logging/Logger.ts index d80bf04ed9..c7170c63e1 100644 --- a/server/logging/Logger.ts +++ b/server/logging/Logger.ts @@ -26,6 +26,7 @@ type LogCategory = | "database" | "utils" | "plugins"; + type Extra = Record; class Logger {