mirror of
https://github.com/koloideal/DutyLog.git
synced 2026-06-10 10:25:29 +03:00
update
This commit is contained in:
@@ -648,13 +648,13 @@ resident_info_window = Window(
|
||||
Format("{info_content}"),
|
||||
Row(
|
||||
Button(
|
||||
Const("Добавить часы"),
|
||||
Const("➕ Добавить"),
|
||||
id="add_hours_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.add_hours_select),
|
||||
when=~F["is_admin"],
|
||||
),
|
||||
Button(
|
||||
Const("Отнять часы"),
|
||||
Const("➖️ Отнять"),
|
||||
id="remove_hours_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.remove_hours_select),
|
||||
when=~F["is_admin"],
|
||||
@@ -672,17 +672,19 @@ resident_info_window = Window(
|
||||
on_click=on_rebind_resident,
|
||||
when=~F["is_admin"],
|
||||
),
|
||||
Button(
|
||||
Const("🚪 Разлогинить"),
|
||||
id="logout_resident_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.resident_logout_confirm),
|
||||
when=F["is_busy"] & ~F["is_admin"],
|
||||
),
|
||||
Button(
|
||||
Const("🗑 Удалить резидента"),
|
||||
id="delete_resident_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.resident_delete_confirm),
|
||||
when=~F["is_admin"],
|
||||
Row(
|
||||
Button(
|
||||
Const("🚪 Разлогинить"),
|
||||
id="logout_resident_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.resident_logout_confirm),
|
||||
when=F["is_busy"] & ~F["is_admin"],
|
||||
),
|
||||
Button(
|
||||
Const("🗑 Удалить"),
|
||||
id="delete_resident_btn",
|
||||
on_click=lambda c, b, m: m.switch_to(AdminMenuSG.resident_delete_confirm),
|
||||
when=~F["is_admin"],
|
||||
)
|
||||
),
|
||||
SwitchTo(
|
||||
Const("◀️ Назад к результатам поиска"),
|
||||
|
||||
@@ -38,6 +38,9 @@ async def start_handler(
|
||||
last_name=message.from_user.last_name,
|
||||
)
|
||||
|
||||
if user and user.username != message.from_user.username:
|
||||
await users_repository.update_user(user_id=message.from_user.id, username=message.from_user.id)
|
||||
|
||||
is_creator = message.from_user.id == config.bot.creator_id
|
||||
is_admin = user.is_admin if user else False
|
||||
|
||||
|
||||
@@ -24,20 +24,6 @@ class UsersRepository:
|
||||
user = await self.users_dao.create(user)
|
||||
return user
|
||||
|
||||
async def update_user_info(
|
||||
self,
|
||||
user_id: int,
|
||||
username: str | None = None,
|
||||
first_name: str | None = None,
|
||||
last_name: str | None = None,
|
||||
) -> User | None:
|
||||
return await self.users_dao.update(
|
||||
user_id,
|
||||
username=username,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
)
|
||||
|
||||
async def set_admin_status(self, user_id: int, is_admin: bool) -> User | None:
|
||||
return await self.users_dao.update(user_id, is_admin=is_admin)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user