diff --git a/bot/src/bot_graphql/abc/query_abc.py b/bot/src/bot_graphql/abc/query_abc.py index 10b9b8f3..71d9b267 100644 --- a/bot/src/bot_graphql/abc/query_abc.py +++ b/bot/src/bot_graphql/abc/query_abc.py @@ -30,6 +30,7 @@ from bot_data.model.user_joined_game_server import UserJoinedGameServer from bot_data.model.user_joined_server import UserJoinedServer from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel from bot_data.model.user_role_enum import UserRoleEnum +from bot_data.model.user_warnings import UserWarnings from bot_graphql.abc.filter_abc import FilterABC from bot_graphql.filter.page import Page from bot_graphql.filter.sort import Sort @@ -164,6 +165,15 @@ class QueryABC(ObjectType): access = True break + elif type(element) == UserWarnings: + for u in user.users: + u: User = u + guild = bot.get_guild(u.server.discord_id) + member = guild.get_member(u.discord_id) + if u.id == element.user.id or permissions.is_member_moderator(member): + access = True + break + elif type(element) == UserJoinedServer: for u in user.users: u: User = u diff --git a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts index 749b0323..e8b1d761 100644 --- a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts +++ b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts @@ -79,11 +79,11 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit, public ngOnInit(): void { this.loading = true; - this.setFilterForm(); this.data.getServerFromRoute(this.route).then(async server => { this.server = server; let authUser = await this.authService.getLoggedInUser(); this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null; + this.setFilterForm(); }); }