Fixed user warnings
This commit is contained in:
parent
dfee6b0568
commit
fbdac4f57a
@ -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
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user