Do not add a fallback field reference if front side contains conditionals (#2859)

* Do not add a fallback field ref if front contains conditionals

* Ensure field reference when there are only conditionals
This commit is contained in:
Abdo 2023-12-06 03:06:28 +03:00 committed by GitHub
parent 987a46978b
commit 27b2bce604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -741,9 +741,9 @@ impl ParsedTemplate {
} }
pub(crate) fn contains_field_replacement(&self) -> bool { pub(crate) fn contains_field_replacement(&self) -> bool {
self.0 let mut set = HashSet::new();
.iter() find_field_references(&self.0, &mut set, false, false);
.any(|node| matches!(node, ParsedNode::Replacement { key: _, filters: _ })) !set.is_empty()
} }
pub(crate) fn add_missing_field_replacement(&mut self, field_name: &str, is_cloze: bool) { pub(crate) fn add_missing_field_replacement(&mut self, field_name: &str, is_cloze: bool) {