Skip to content

Commit 8299a95

Browse files
committed
Bug 1973636 - Add isNewUntil Search Definition to
Rust Engine Selector.
1 parent f2a0f9e commit 8299a95

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

components/search/src/configuration_types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ pub(crate) struct JSONEngineVariant {
169169
/// Details of the possible user environments that this variant applies to.
170170
pub environment: JSONVariantEnvironment,
171171

172+
/// Indicates the date until which the engine variant or subvariant is considered new
173+
/// (format: YYYY-MM-DD).
174+
pub is_new_until: Option<String>,
175+
172176
/// This search engine is presented as an option that the user may enable.
173177
/// If not specified, defaults to false.
174178
#[serde(default)]

components/search/src/filter.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ impl SearchEngineDefinition {
9494
if let Some(urls) = &variant.urls {
9595
self.urls.merge(urls);
9696
}
97+
if let Some(is_new_until) = &variant.is_new_until {
98+
self.is_new_until = Some(is_new_until.clone());
99+
}
97100
}
98101

99102
fn merge_override(&mut self, override_record: &JSONOverridesRecord) {
@@ -124,6 +127,7 @@ impl SearchEngineDefinition {
124127
telemetry_suffix: String::new(),
125128
urls: base.urls.into(),
126129
click_url: None,
130+
is_new_until: None,
127131
};
128132

129133
engine_definition.merge_variant(variant);
@@ -542,6 +546,7 @@ mod tests {
542546
all_regions_and_locales: true,
543547
..Default::default()
544548
},
549+
is_new_until: None,
545550
optional: false,
546551
partner_code: None,
547552
telemetry_suffix: None,
@@ -558,6 +563,7 @@ mod tests {
558563
charset: "UTF-8".to_string(),
559564
classification: SearchEngineClassification::General,
560565
identifier: "test".to_string(),
566+
is_new_until: None,
561567
partner_code: String::new(),
562568
name: "Test".to_string(),
563569
optional: false,
@@ -651,6 +657,7 @@ mod tests {
651657
all_regions_and_locales: true,
652658
..Default::default()
653659
},
660+
is_new_until: None,
654661
optional: false,
655662
partner_code: None,
656663
telemetry_suffix: None,
@@ -667,6 +674,7 @@ mod tests {
667674
charset: "ISO-8859-15".to_string(),
668675
classification: SearchEngineClassification::Unknown,
669676
identifier: "test".to_string(),
677+
is_new_until: None,
670678
partner_code: "firefox".to_string(),
671679
name: "Test".to_string(),
672680
optional: false,
@@ -741,6 +749,7 @@ mod tests {
741749
all_regions_and_locales: true,
742750
..Default::default()
743751
},
752+
is_new_until: None,
744753
optional: true,
745754
partner_code: Some("trek".to_string()),
746755
telemetry_suffix: Some("star".to_string()),
@@ -802,6 +811,7 @@ mod tests {
802811
charset: "ISO-8859-15".to_string(),
803812
classification: SearchEngineClassification::Unknown,
804813
identifier: "test".to_string(),
814+
is_new_until: None,
805815
partner_code: "trek".to_string(),
806816
name: "Test".to_string(),
807817
optional: true,
@@ -868,6 +878,7 @@ mod tests {
868878
all_regions_and_locales: true,
869879
..Default::default()
870880
},
881+
is_new_until: None,
871882
optional: true,
872883
partner_code: Some("trek".to_string()),
873884
telemetry_suffix: Some("star".to_string()),
@@ -928,6 +939,7 @@ mod tests {
928939
all_regions_and_locales: true,
929940
..Default::default()
930941
},
942+
is_new_until: None,
931943
optional: true,
932944
partner_code: Some("trek2".to_string()),
933945
telemetry_suffix: Some("star2".to_string()),
@@ -988,6 +1000,7 @@ mod tests {
9881000
charset: "ISO-8859-15".to_string(),
9891001
classification: SearchEngineClassification::Unknown,
9901002
identifier: "test".to_string(),
1003+
is_new_until: None,
9911004
partner_code: "trek2".to_string(),
9921005
name: "Test".to_string(),
9931006
optional: true,

components/search/src/selector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ mod tests {
549549
charset: "UTF-8".to_string(),
550550
classification: SearchEngineClassification::Unknown,
551551
identifier: "test2".to_string(),
552+
is_new_until: None,
552553
name: "Test 2".to_string(),
553554
optional: false,
554555
order_hint: None,

components/search/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ pub struct SearchEngineDefinition {
183183
/// also used to form the base telemetry id and may be extended by telemetrySuffix.
184184
pub identifier: String,
185185

186+
/// Indicates the date until which the engine variant or subvariant is considered new
187+
/// (format: YYYY-MM-DD).
188+
pub is_new_until: Option<String>,
189+
186190
/// The user visible name of the search engine.
187191
pub name: String,
188192

0 commit comments

Comments
 (0)