mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 06:48:04 +03:00
fix: allow invites to be infinitely created if you're an admin
This commit is contained in:
@@ -11,7 +11,7 @@ import useApiQuery from "components/util/query/useApiQuery";
|
||||
import React from "react";
|
||||
import { Button, Col, Row } from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
import { integer, InviteCodeDocument, UserDocument } from "tachi-common";
|
||||
import { integer, InviteCodeDocument, UserAuthLevels, UserDocument } from "tachi-common";
|
||||
import Icon from "components/util/Icon";
|
||||
|
||||
export default function UserInvitesPage({ reqUser }: { reqUser: UserDocument }) {
|
||||
@@ -51,32 +51,33 @@ export default function UserInvitesPage({ reqUser }: { reqUser: UserDocument })
|
||||
</span>
|
||||
<Divider />
|
||||
</Col>
|
||||
{newInvites !== 0 && (
|
||||
<Col xs={12}>
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const r = await APIFetchV1(
|
||||
`/users/${reqUser.id}/invites/create`,
|
||||
{
|
||||
method: "POST",
|
||||
},
|
||||
true,
|
||||
true
|
||||
);
|
||||
{newInvites !== 0 ||
|
||||
(reqUser.authLevel === UserAuthLevels.ADMIN && (
|
||||
<Col xs={12}>
|
||||
<div className="d-flex justify-content-center">
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const r = await APIFetchV1(
|
||||
`/users/${reqUser.id}/invites/create`,
|
||||
{
|
||||
method: "POST",
|
||||
},
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
if (r.success) {
|
||||
DelayedPageReload();
|
||||
}
|
||||
}}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Create new Invite
|
||||
</Button>
|
||||
</div>
|
||||
<Divider />
|
||||
</Col>
|
||||
)}
|
||||
if (r.success) {
|
||||
DelayedPageReload();
|
||||
}
|
||||
}}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Create new Invite
|
||||
</Button>
|
||||
</div>
|
||||
<Divider />
|
||||
</Col>
|
||||
))}
|
||||
<Col xs={12}>
|
||||
<h4 className="text-center mb-4">Your Invites</h4>
|
||||
<InviteList reqUser={reqUser} />
|
||||
|
||||
Reference in New Issue
Block a user