Skip to content

Commit fc159b5

Browse files
authored
Merge pull request #4738 from alphagov/rp-fix-archive-files-for-archived-template-bug
fixed update template logic so that we do not return files that have already been archived
2 parents b4146c5 + 343471d commit fc159b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/template/rest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from app.dao.template_email_files_dao import (
2121
dao_archive_template_email_file,
2222
dao_get_template_email_file_by_id,
23+
dao_get_template_email_files_by_template_id,
2324
)
2425
from app.dao.template_folder_dao import (
2526
dao_get_template_folder_by_id_and_service_id,
@@ -161,7 +162,7 @@ def update_template(service_id, template_id): # noqa: C901
161162

162163
dao_update_template(update_dict)
163164
if update_dict.archived:
164-
file_ids_to_archive = [file.id for file in update_dict.email_files]
165+
file_ids_to_archive = [file.id for file in dao_get_template_email_files_by_template_id(template_id)]
165166
else:
166167
file_ids_to_archive = data.get("archive_email_file_ids")
167168
if file_ids_to_archive:

0 commit comments

Comments
 (0)