mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Pass original file name when sending contact list
Otherwise the new file doesn’t get a name, which is very confusing.
This commit is contained in:
@@ -520,11 +520,16 @@ def choose_from_contact_list(service_id, template_id):
|
||||
)
|
||||
@user_has_permissions('send_messages')
|
||||
def send_from_contact_list(service_id, template_id, contact_list_id):
|
||||
contact_list = ContactList.from_id(
|
||||
contact_list_id,
|
||||
service_id=current_service.id,
|
||||
)
|
||||
return redirect(url_for(
|
||||
'main.check_messages',
|
||||
service_id=current_service.id,
|
||||
template_id=template_id,
|
||||
upload_id=ContactList.copy_to_uploads(service_id, contact_list_id),
|
||||
upload_id=contact_list.copy_to_uploads(),
|
||||
original_file_name=contact_list.original_file_name,
|
||||
))
|
||||
|
||||
|
||||
|
||||
@@ -76,17 +76,15 @@ class ContactList(JSONModel):
|
||||
bucket=ContactList.get_bucket_name(),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def copy_to_uploads(service_id, upload_id):
|
||||
contents = ContactList.download(service_id, upload_id)
|
||||
metadata = ContactList.get_metadata(service_id, upload_id)
|
||||
def copy_to_uploads(self):
|
||||
metadata = self.get_metadata(self.service_id, self.id)
|
||||
new_upload_id = s3upload(
|
||||
service_id,
|
||||
{'data': contents},
|
||||
self.service_id,
|
||||
{'data': self.contents},
|
||||
current_app.config['AWS_REGION'],
|
||||
)
|
||||
set_metadata_on_csv_upload(
|
||||
service_id,
|
||||
self.service_id,
|
||||
new_upload_id,
|
||||
**metadata,
|
||||
)
|
||||
|
||||
@@ -3988,6 +3988,7 @@ def test_send_from_contact_list(
|
||||
mocker,
|
||||
client_request,
|
||||
fake_uuid,
|
||||
mock_get_contact_lists,
|
||||
):
|
||||
new_uuid = uuid.uuid4()
|
||||
mock_download = mocker.patch('app.models.contact_list.s3download', return_value='contents')
|
||||
@@ -4007,6 +4008,7 @@ def test_send_from_contact_list(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
upload_id=new_uuid,
|
||||
original_file_name='EmergencyContactList.xls',
|
||||
_external=True,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user