mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-06 14:30:57 -04:00
With the addition of template folders we need to filter templates based on a combination of type and parent folder ID. This replaces the existing `templates_by_type` method with `get_templates`, which supports both type and parent folder filters, avoiding a need to create specific methods for each use case. We still need the templates property to exist in some way in order to cache it, but it needs to be clear that it's different from `.get_templates`. One option was to make it "private" (i.e. `_templates`), and always use `.get_templates` in the rest of the code, but this requires adding "include all folders" to `.get_templates`, which doesn't have an obvious interface since `parent_folder_id=None` already means "top-level only". This will probably come up again when we need to look into adding templates from nested folders into the page for live search, but for now renaming `Service.templates` to `.all_templates` makes it clear what the property contains.