Fixed user warnings
All checks were successful
Deploy prod on push / pre-build (push) Successful in 1s
Deploy prod on push / build-bot (push) Successful in 3m1s
Deploy prod on push / build-web (push) Successful in 1m47s
Deploy prod on push / deploy (push) Successful in 21s

This commit is contained in:
Sven Heidemann 2024-01-26 17:02:52 +01:00
parent dfee6b0568
commit fbdac4f57a
2 changed files with 11 additions and 1 deletions

View File

@ -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_server import UserJoinedServer
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
from bot_data.model.user_role_enum import UserRoleEnum 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.abc.filter_abc import FilterABC
from bot_graphql.filter.page import Page from bot_graphql.filter.page import Page
from bot_graphql.filter.sort import Sort from bot_graphql.filter.sort import Sort
@ -164,6 +165,15 @@ class QueryABC(ObjectType):
access = True access = True
break 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: elif type(element) == UserJoinedServer:
for u in user.users: for u in user.users:
u: User = u u: User = u

View File

@ -79,11 +79,11 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
public ngOnInit(): void { public ngOnInit(): void {
this.loading = true; this.loading = true;
this.setFilterForm();
this.data.getServerFromRoute(this.route).then(async server => { this.data.getServerFromRoute(this.route).then(async server => {
this.server = server; this.server = server;
let authUser = await this.authService.getLoggedInUser(); let authUser = await this.authService.getLoggedInUser();
this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null; this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null;
this.setFilterForm();
}); });
} }