feat: respect Settings.GuildInvRestriction for addToGuild
All checks were successful
Build / build (20) (push) Successful in 46s
Build / build (22) (push) Successful in 1m12s
Build / build (18) (push) Successful in 1m27s
Build / build (18) (pull_request) Successful in 58s
Build / build (20) (pull_request) Successful in 1m11s
Build / build (22) (pull_request) Successful in 1m26s
All checks were successful
Build / build (20) (push) Successful in 46s
Build / build (22) (push) Successful in 1m12s
Build / build (18) (push) Successful in 1m27s
Build / build (18) (pull_request) Successful in 58s
Build / build (20) (pull_request) Successful in 1m11s
Build / build (22) (pull_request) Successful in 1m26s
This commit is contained in:
parent
2b9eb1844d
commit
500e901e5f
@ -18,6 +18,13 @@ export const addToGuildController: RequestHandler = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const inventory = await getInventory(account._id.toString(), "Settings");
|
||||||
|
// TODO: Also consider GIFT_MODE_FRIENDS once friends are implemented
|
||||||
|
if (inventory.Settings?.GuildInvRestriction == "GIFT_MODE_NONE") {
|
||||||
|
res.status(400).json("Invite restricted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const guild = (await Guild.findById(payload.GuildId.$oid, "Name"))!;
|
const guild = (await Guild.findById(payload.GuildId.$oid, "Name"))!;
|
||||||
const senderAccount = await getAccountForRequest(req);
|
const senderAccount = await getAccountForRequest(req);
|
||||||
if (!(await hasGuildPermission(guild, senderAccount._id.toString(), GuildPermission.Recruiter))) {
|
if (!(await hasGuildPermission(guild, senderAccount._id.toString(), GuildPermission.Recruiter))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user