mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-29 18:40:10 -04:00
Fix inviting existing users
The API needs the id of the user, not the id of the invite. The problem with the tests is that the update mock returned a different user ID than the user it was being passed. So the tests didn’t catch this.
This commit is contained in:
@@ -65,7 +65,7 @@ def accept_invite(token):
|
||||
invited_user.auth_type == 'email_auth'
|
||||
):
|
||||
existing_user.update(auth_type=invited_user.auth_type)
|
||||
invited_user.add_to_service()
|
||||
invited_user.add_to_service(existing_user_id=existing_user.id)
|
||||
return redirect(url_for('main.service_dashboard', service_id=service.id))
|
||||
else:
|
||||
return redirect(url_for('main.register_from_invite'))
|
||||
|
||||
@@ -348,10 +348,10 @@ class InvitedUser(JSONModel):
|
||||
def accept_invite(self):
|
||||
invite_api_client.accept_invite(self.service, self.id)
|
||||
|
||||
def add_to_service(self):
|
||||
def add_to_service(self, existing_user_id):
|
||||
user_api_client.add_user_to_service(
|
||||
self.service,
|
||||
self.id,
|
||||
existing_user_id,
|
||||
self.permissions,
|
||||
self.folder_permissions,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user