Only add roles to teams

This commit is contained in:
rxdn 2024-07-03 15:03:54 +01:00
parent 46e22195c1
commit 3357fa2d41
2 changed files with 5 additions and 31 deletions

View File

@ -29,6 +29,11 @@ func AddMember(ctx *gin.Context) {
return
}
if entityType == entityTypeUser {
ctx.JSON(400, utils.ErrorStr("Only roles may be added as support representatives"))
return
}
if entityType == entityTypeRole && snowflake == guildId {
ctx.JSON(400, utils.ErrorStr("You cannot add the @everyone role as staff"))
return

View File

@ -58,19 +58,6 @@
</div>
<div class="col">
<h3>Add Member</h3>
<div class="user-select">
<div style="display: flex; flex: 1">
<UserSelect {guildId} bind:value={selectedUser}/>
</div>
<div style="margin-left: 10px">
<Button type="button" icon="fas fa-plus" disabled={selectedUser === null || selectedUser === undefined}
on:click={addUser}>Add To Team
</Button>
</div>
</div>
<h3>Add Role</h3>
<div class="user-select">
<div class="col-1" style="display: flex; flex: 1">
@ -140,24 +127,6 @@
members = res.data;
}
async function addUser() {
const res = await axios.put(`${API_URL}/api/${guildId}/team/${activeTeam}/${selectedUser.id}?type=0`);
if (res.status !== 200) {
notifyError(res.data.error);
return;
}
notifySuccess(`${selectedUser.username} has been added to the support team ${getTeam(activeTeam).name}`);
let entity = {
id: selectedUser.id,
type: 0,
name: `${selectedUser.username}`
}
members = [...members, entity];
selectedUser = undefined;
}
async function addRole() {
const res = await axios.put(`${API_URL}/api/${guildId}/team/${activeTeam}/${selectedRole.id}?type=1`);
if (res.status !== 200) {