返回提交历史
Modified
src/controllers/api/addToGuildController.ts
+7
-0
XFEstudio/SpaceNinjaServer
feat: respect Settings.GuildInvRestriction for addToGuild (#1345)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1345 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
692dfaf0
代码差异
1 个文件
+7
-0
@@ -18,6 +18,13 @@ export const addToGuildController: RequestHandler = async (req, res) => {
18
18
return;
19
19
}
20
20
21
const inventory = await getInventory(account._id.toString(), "Settings");
22
// TODO: Also consider GIFT_MODE_FRIENDS once friends are implemented
23
if (inventory.Settings?.GuildInvRestriction == "GIFT_MODE_NONE") {
24
res.status(400).json("Invite restricted");
25
return;
26
}
27
21
28
const guild = (await Guild.findById(payload.GuildId.$oid, "Name"))!;
22
29
const senderAccount = await getAccountForRequest(req);
23
30
if (!(await hasGuildPermission(guild, senderAccount._id.toString(), GuildPermission.Recruiter))) {