mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
DRY-up and enforce kwargs for most events
For most events this makes the purpose of each argument clearer at the point the event is called. It's still worth having a function for each event type, as this abstracts knowledge of the event label. Using a schema approach will make adding new events easier. In the next commit we'll DRY-up the duplication in the tests as well.
This commit is contained in:
@@ -173,7 +173,11 @@ def remove_user_from_service(service_id, user_id):
|
||||
else:
|
||||
abort(500, e)
|
||||
else:
|
||||
create_remove_user_from_service_event(user_id=user_id, removed_by_id=current_user.id, service_id=service_id)
|
||||
create_remove_user_from_service_event(
|
||||
user_id=user_id,
|
||||
removed_by_id=current_user.id,
|
||||
service_id=service_id
|
||||
)
|
||||
|
||||
return redirect(url_for(
|
||||
'.manage_users',
|
||||
@@ -228,7 +232,12 @@ def confirm_edit_user_email(service_id, user_id):
|
||||
except HTTPError as e:
|
||||
abort(500, e)
|
||||
else:
|
||||
create_email_change_event(user.id, current_user.id, user.email_address, new_email)
|
||||
create_email_change_event(
|
||||
user_id=user.id,
|
||||
updated_by_id=current_user.id,
|
||||
original_email_address=user.email_address,
|
||||
new_email_address=new_email
|
||||
)
|
||||
finally:
|
||||
session.pop(session_key, None)
|
||||
|
||||
@@ -286,7 +295,12 @@ def confirm_edit_user_mobile_number(service_id, user_id):
|
||||
except HTTPError as e:
|
||||
abort(500, e)
|
||||
else:
|
||||
create_mobile_number_change_event(user.id, current_user.id, user.mobile_number, new_number)
|
||||
create_mobile_number_change_event(
|
||||
user_id=user.id,
|
||||
updated_by_id=current_user.id,
|
||||
original_mobile_number=user.mobile_number,
|
||||
new_mobile_number=new_number
|
||||
)
|
||||
finally:
|
||||
session.pop('team_member_mobile_change', None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user