Fixed update user #455
This commit is contained in:
parent
13bc38fea8
commit
84ff2a8a9b
@ -4,6 +4,7 @@ from cpl_core.database.context import DatabaseContextABC
|
|||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
|
|
||||||
from bot_api.route.route import Route
|
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.level_repository_abc import LevelRepositoryABC
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
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 bot_graphql.abc.query_abc import QueryABC
|
||||||
from modules.base.service.user_warnings_service import UserWarningsService
|
from modules.base.service.user_warnings_service import UserWarningsService
|
||||||
from modules.level.service.level_service import LevelService
|
from modules.level.service.level_service import LevelService
|
||||||
from bot_core.service.permission_service import PermissionService
|
|
||||||
|
|
||||||
|
|
||||||
class UserMutation(QueryABC):
|
class UserMutation(QueryABC):
|
||||||
@ -50,7 +50,7 @@ class UserMutation(QueryABC):
|
|||||||
member = self._bot.get_guild(user.server.discord_id).get_member(
|
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
|
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)
|
self._can_user_mutate_data(user.server, UserRoleEnum.moderator)
|
||||||
|
|
||||||
new_xp = None
|
new_xp = None
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
<div class="content-data-name">{{'view.server.profile.birthday' | translate}}:</div>
|
<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">{{user.birthday}}</div>
|
||||||
<div *ngIf="isEditing" class="content-data-value">
|
<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>
|
</div>
|
||||||
<div class="content-divider"></div>
|
<div class="content-divider"></div>
|
||||||
|
@ -150,7 +150,7 @@ export class ProfileComponent implements OnInit, OnDestroy {
|
|||||||
this.data.mutation<UpdateUserMutationResult>(Mutations.updateUser, {
|
this.data.mutation<UpdateUserMutationResult>(Mutations.updateUser, {
|
||||||
id: this.user.id,
|
id: this.user.id,
|
||||||
xp: this.user.xp,
|
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,
|
levelId: this.user.level?.id,
|
||||||
userWarnings: this.user.userWarnings?.map(userWarning => {
|
userWarnings: this.user.userWarnings?.map(userWarning => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user