mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 21:38:06 +03:00
feat: allow admins to make invites regardless of max allowed
This commit is contained in:
@@ -3,6 +3,7 @@ import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { GetTotalAllowedInvites } from "lib/invites/invites";
|
||||
import { RequireKamaitachi } from "server/middleware/type-require";
|
||||
import { UserAuthLevels } from "tachi-common";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
import { GetTachiData } from "utils/req-tachi-data";
|
||||
import { GetUsersWithIDs } from "utils/user";
|
||||
@@ -82,7 +83,10 @@ router.post("/create", async (req, res) => {
|
||||
|
||||
const existingInvites = await db.invites.count({ createdBy: user.id });
|
||||
|
||||
if (existingInvites >= GetTotalAllowedInvites(user)) {
|
||||
if (
|
||||
existingInvites >= GetTotalAllowedInvites(user) &&
|
||||
user.authLevel !== UserAuthLevels.ADMIN
|
||||
) {
|
||||
InviteLocks.delete(user.id);
|
||||
|
||||
return res.status(400).json({
|
||||
|
||||
Reference in New Issue
Block a user