mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Don’t implement separate __getitem__ for invited users
It can inherit now because both `User.__init__` and `InvitedUser.__init__` have the same method signature.
This commit is contained in:
@@ -528,12 +528,13 @@ class AnonymousUser(AnonymousUserMixin):
|
|||||||
class Users(Sequence):
|
class Users(Sequence):
|
||||||
|
|
||||||
client = user_api_client.get_users_for_service
|
client = user_api_client.get_users_for_service
|
||||||
|
model = User
|
||||||
|
|
||||||
def __init__(self, service_id):
|
def __init__(self, service_id):
|
||||||
self.users = self.client(service_id)
|
self.users = self.client(service_id)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
return User(self.users[index])
|
return self.model(self.users[index])
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.users)
|
return len(self.users)
|
||||||
@@ -557,9 +558,6 @@ class InvitedUsers(Users):
|
|||||||
if user['status'] != 'accepted'
|
if user['status'] != 'accepted'
|
||||||
]
|
]
|
||||||
|
|
||||||
def __getitem__(self, index):
|
|
||||||
return self.model(self.users[index])
|
|
||||||
|
|
||||||
|
|
||||||
class OrganisationInvitedUsers(InvitedUsers):
|
class OrganisationInvitedUsers(InvitedUsers):
|
||||||
client = org_invite_api_client.get_invites_for_organisation
|
client = org_invite_api_client.get_invites_for_organisation
|
||||||
|
|||||||
Reference in New Issue
Block a user