From 84ff2a8a9b64834dcb8292b8b0beef37bd0e716d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 10 Dec 2023 19:18:20 +0100 Subject: [PATCH] Fixed update user #455 --- bot/src/bot_graphql/mutations/user_mutation.py | 4 ++-- .../app/modules/view/server/profile/profile.component.html | 3 ++- web/src/app/modules/view/server/profile/profile.component.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bot/src/bot_graphql/mutations/user_mutation.py b/bot/src/bot_graphql/mutations/user_mutation.py index e203deb8..8d5fb779 100644 --- a/bot/src/bot_graphql/mutations/user_mutation.py +++ b/bot/src/bot_graphql/mutations/user_mutation.py @@ -4,6 +4,7 @@ from cpl_core.database.context import DatabaseContextABC from cpl_discord.service import DiscordBotServiceABC from bot_api.route.route import Route +from bot_core.service.permission_service import PermissionService from bot_data.abc.level_repository_abc import LevelRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.abc.user_repository_abc import UserRepositoryABC @@ -13,7 +14,6 @@ from bot_data.model.user_role_enum import UserRoleEnum from bot_graphql.abc.query_abc import QueryABC from modules.base.service.user_warnings_service import UserWarningsService from modules.level.service.level_service import LevelService -from bot_core.service.permission_service import PermissionService class UserMutation(QueryABC): @@ -50,7 +50,7 @@ class UserMutation(QueryABC): member = self._bot.get_guild(user.server.discord_id).get_member( auth_user.users.where(lambda x: x.server.id == user.server.id).single().discord_id ) - if member.id != user.discord_id: + if self._permissions.is_member_moderator(member) or member.id != user.discord_id: self._can_user_mutate_data(user.server, UserRoleEnum.moderator) new_xp = None diff --git a/web/src/app/modules/view/server/profile/profile.component.html b/web/src/app/modules/view/server/profile/profile.component.html index ba88ccfe..c5c6fd3d 100644 --- a/web/src/app/modules/view/server/profile/profile.component.html +++ b/web/src/app/modules/view/server/profile/profile.component.html @@ -33,7 +33,8 @@
{{'view.server.profile.birthday' | translate}}:
{{user.birthday}}
- +
diff --git a/web/src/app/modules/view/server/profile/profile.component.ts b/web/src/app/modules/view/server/profile/profile.component.ts index c66a5393..9735c675 100644 --- a/web/src/app/modules/view/server/profile/profile.component.ts +++ b/web/src/app/modules/view/server/profile/profile.component.ts @@ -150,7 +150,7 @@ export class ProfileComponent implements OnInit, OnDestroy { this.data.mutation(Mutations.updateUser, { id: this.user.id, xp: this.user.xp, - birthday: moment(this.user.birthday).format("DD.MM.YYYY"), + birthday: moment(this.user.birthday, "DD.MM.YYYY").format("DD.MM.YYYY"), levelId: this.user.level?.id, userWarnings: this.user.userWarnings?.map(userWarning => { return {