feat: switch admin identification from user_id to username
- Replace admin_user_ids (list[int]) with admin_usernames (list[str]) - Update all service methods to use username for permission checks - Add delete button to bot responses for message cleanup - Update tests to match new implementation Note: Breaking change - existing data files need fresh start
This commit is contained in:
@@ -122,7 +122,7 @@ class TestRoomData:
|
||||
assert rd.bounties == []
|
||||
assert rd.next_id == 1
|
||||
assert rd.timezone is None
|
||||
assert rd.admin_user_ids == []
|
||||
assert rd.admin_usernames == []
|
||||
|
||||
def test_create_dm_room_data(self):
|
||||
rd = RoomData(
|
||||
@@ -134,7 +134,7 @@ class TestRoomData:
|
||||
assert rd.bounties == []
|
||||
assert rd.next_id == 1
|
||||
assert rd.timezone is None
|
||||
assert rd.admin_user_ids == []
|
||||
assert rd.admin_usernames == []
|
||||
|
||||
def test_room_data_with_bounties(self):
|
||||
b = Bounty(
|
||||
@@ -156,18 +156,18 @@ class TestRoomData:
|
||||
bounties=[],
|
||||
next_id=1,
|
||||
timezone="Asia/Jakarta",
|
||||
admin_user_ids=[123, 456],
|
||||
admin_usernames=["alice", "bob"],
|
||||
)
|
||||
assert rd.timezone == "Asia/Jakarta"
|
||||
assert rd.admin_user_ids == [123, 456]
|
||||
assert rd.admin_usernames == ["alice", "bob"]
|
||||
|
||||
def test_room_data_admin_user_ids_defaults_to_empty_list(self):
|
||||
def test_room_data_admin_usernames_defaults_to_empty_list(self):
|
||||
rd = RoomData(
|
||||
room_id=-1001,
|
||||
bounties=[],
|
||||
next_id=1,
|
||||
)
|
||||
assert rd.admin_user_ids == []
|
||||
assert rd.admin_usernames == []
|
||||
|
||||
|
||||
class TestTrackingData:
|
||||
|
||||
Reference in New Issue
Block a user