Skip to content

Commit

Permalink
Remove need for quota
Browse files Browse the repository at this point in the history
  • Loading branch information
handotdev committed Apr 27, 2023
1 parent 90e930b commit 02e108d
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions server/routes/writer/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ export const getDocument = async (
};

const MAX_DOCS_FOR_AUTH = 60;
const MAX_DOCS_FOR_PREMIUM = 600;
const DAYS_PER_QUOTA_PERIOD = 30;

export const checkIfUserShouldAuthenticate = async (req, res, next) => {
Expand All @@ -268,7 +267,7 @@ export const checkIfUserShouldAuthenticate = async (req, res, next) => {
});
const identifiedUserPromise = email ? User.findOne({ email }) : null;
const existsInTeamPromise = email ? Team.exists({ members: email }) : null;
const [docsCount, identifiedUser, existsInTeam] = await Promise.all([
const [docsCount, identifiedUser] = await Promise.all([
docsCountPromise,
identifiedUserPromise,
existsInTeamPromise,
Expand All @@ -282,19 +281,6 @@ export const checkIfUserShouldAuthenticate = async (req, res, next) => {
button: '🔐 Sign in',
error: 'Please update the extension to continue',
});
} else if (
identifiedUser?.plan !== Plan.Premium &&
!existsInTeam &&
docsCount > MAX_DOCS_FOR_PREMIUM
) {
track(userId, 'Docs Quota Exceeded', {
email,
});
return res.status(401).send({
requiresUpgrade: true,
message: 'You have reached the free monthly quota',
error: 'Please update the extension to v2.0.0 to continue',
});
}

User.updateOne({ userId }, { lastActiveAt: new Date() });
Expand Down

0 comments on commit 02e108d

Please sign in to comment.