Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

- The `SearchEngineSelector::filter_engine_configuration` will now sort any
unordered engines by name rather than identifier.
- Added `is_new_until` field to the SearchEngineDefinition struct. This optional field represents the date in YYYY-MM-DD format until which a search engine variant or subvariant is considered "new".

[Full Changelog](https://github.com/mozilla/application-services/compare/v139.0...v140.0)

Expand Down
4 changes: 4 additions & 0 deletions components/search/src/configuration_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ pub(crate) struct JSONEngineVariant {
/// Details of the possible user environments that this variant applies to.
pub environment: JSONVariantEnvironment,

/// Indicates the date until which the engine variant or subvariant is considered new
/// (format: YYYY-MM-DD).
pub is_new_until: Option<String>,

/// This search engine is presented as an option that the user may enable.
/// If not specified, defaults to false.
#[serde(default)]
Expand Down
13 changes: 13 additions & 0 deletions components/search/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ impl SearchEngineDefinition {
if let Some(urls) = &variant.urls {
self.urls.merge(urls);
}
if let Some(is_new_until) = &variant.is_new_until {
self.is_new_until = Some(is_new_until.clone());
}
}

fn merge_override(&mut self, override_record: &JSONOverridesRecord) {
Expand Down Expand Up @@ -124,6 +127,7 @@ impl SearchEngineDefinition {
telemetry_suffix: String::new(),
urls: base.urls.into(),
click_url: None,
is_new_until: None,
};

engine_definition.merge_variant(variant);
Expand Down Expand Up @@ -542,6 +546,7 @@ mod tests {
all_regions_and_locales: true,
..Default::default()
},
is_new_until: None,
optional: false,
partner_code: None,
telemetry_suffix: None,
Expand All @@ -558,6 +563,7 @@ mod tests {
charset: "UTF-8".to_string(),
classification: SearchEngineClassification::General,
identifier: "test".to_string(),
is_new_until: None,
partner_code: String::new(),
name: "Test".to_string(),
optional: false,
Expand Down Expand Up @@ -651,6 +657,7 @@ mod tests {
all_regions_and_locales: true,
..Default::default()
},
is_new_until: None,
optional: false,
partner_code: None,
telemetry_suffix: None,
Expand All @@ -667,6 +674,7 @@ mod tests {
charset: "ISO-8859-15".to_string(),
classification: SearchEngineClassification::Unknown,
identifier: "test".to_string(),
is_new_until: None,
partner_code: "firefox".to_string(),
name: "Test".to_string(),
optional: false,
Expand Down Expand Up @@ -741,6 +749,7 @@ mod tests {
all_regions_and_locales: true,
..Default::default()
},
is_new_until: Some("2063-04-05".to_string()),
optional: true,
partner_code: Some("trek".to_string()),
telemetry_suffix: Some("star".to_string()),
Expand Down Expand Up @@ -802,6 +811,7 @@ mod tests {
charset: "ISO-8859-15".to_string(),
classification: SearchEngineClassification::Unknown,
identifier: "test".to_string(),
is_new_until: Some("2063-04-05".to_string()),
partner_code: "trek".to_string(),
name: "Test".to_string(),
optional: true,
Expand Down Expand Up @@ -868,6 +878,7 @@ mod tests {
all_regions_and_locales: true,
..Default::default()
},
is_new_until: None,
optional: true,
partner_code: Some("trek".to_string()),
telemetry_suffix: Some("star".to_string()),
Expand Down Expand Up @@ -928,6 +939,7 @@ mod tests {
all_regions_and_locales: true,
..Default::default()
},
is_new_until: Some("2063-04-05".to_string()),
optional: true,
partner_code: Some("trek2".to_string()),
telemetry_suffix: Some("star2".to_string()),
Expand Down Expand Up @@ -988,6 +1000,7 @@ mod tests {
charset: "ISO-8859-15".to_string(),
classification: SearchEngineClassification::Unknown,
identifier: "test".to_string(),
is_new_until: Some("2063-04-05".to_string()),
partner_code: "trek2".to_string(),
name: "Test".to_string(),
optional: true,
Expand Down
1 change: 1 addition & 0 deletions components/search/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ mod tests {
charset: "UTF-8".to_string(),
classification: SearchEngineClassification::Unknown,
identifier: "test2".to_string(),
is_new_until: None,
name: "Test 2".to_string(),
optional: false,
order_hint: None,
Expand Down
4 changes: 4 additions & 0 deletions components/search/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ pub struct SearchEngineDefinition {
/// also used to form the base telemetry id and may be extended by telemetrySuffix.
pub identifier: String,

/// Indicates the date until which the engine variant or subvariant is considered new
/// (format: YYYY-MM-DD).
pub is_new_until: Option<String>,

/// The user visible name of the search engine.
pub name: String,

Expand Down