Fixed update user #455

This commit is contained in:
Sven Heidemann 2023-12-10 19:18:20 +01:00
parent 13bc38fea8
commit 84ff2a8a9b
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -33,7 +33,8 @@
<div class="content-data-name">{{'view.server.profile.birthday' | translate}}:</div>
<div *ngIf="!isEditing" class="content-data-value">{{user.birthday}}</div>
<div *ngIf="isEditing" class="content-data-value">
<p-calendar [(ngModel)]="user.birthday" dateFormat="dd.mm.yy" [showIcon]="true"></p-calendar>
<p-calendar [(ngModel)]="user.birthday" dateFormat="dd.mm.yy"
[showIcon]="true"></p-calendar>
</div>
</div>
<div class="content-divider"></div>

View File

@ -150,7 +150,7 @@ export class ProfileComponent implements OnInit, OnDestroy {
this.data.mutation<UpdateUserMutationResult>(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 {