mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-26 14:48:27 -04:00
Make _attach_current_user a pure function
Mutating dictionaries is gross and doesn’t work as you’d expect. Better to have the function return a new dictionary instead. Means we can be explicit that `created_by` is one of the allowed params when updating a service.
This commit is contained in:
@@ -23,7 +23,7 @@ class InviteApiClient(BaseAPIClient):
|
||||
'from_user': invite_from_id,
|
||||
'permissions': permissions
|
||||
}
|
||||
_attach_current_user(data)
|
||||
data = _attach_current_user(data)
|
||||
resp = self.post(url='/service/{}/invite'.format(service_id), data=data)
|
||||
return InvitedUser(**resp['data'])
|
||||
|
||||
@@ -40,7 +40,7 @@ class InviteApiClient(BaseAPIClient):
|
||||
|
||||
def cancel_invited_user(self, service_id, invited_user_id):
|
||||
data = {'status': 'cancelled'}
|
||||
_attach_current_user(data)
|
||||
data = _attach_current_user(data)
|
||||
self.post(url='/service/{0}/invite/{1}'.format(service_id, invited_user_id),
|
||||
data=data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user