zeta: Fix data collection display on the status bar menu (#24177)

Follow-up to: https://github.com/zed-industries/zed/pull/24031

This PR adds a new function that allows the UI also to display the state
of the data collection. Previously, we only showed that if the project
adhered to the `is_open_source` condition. Now, we show it for all
projects.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-02-04 05:05:28 -03:00 committed by GitHub
parent e5c3273486
commit 386cfacb25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -429,7 +429,7 @@ impl InlineCompletionButton {
menu = menu
.separator()
.header("Help Improve The Model")
.header("For OSS Projects Only");
.header("Valid Only For OSS Projects");
menu = menu.item(
// TODO: We want to add something later that communicates whether
// the current project is open-source.

View file

@ -1359,6 +1359,12 @@ impl ProviderDataCollection {
}
}
pub fn user_data_collection_choice(&self, cx: &App) -> bool {
self.choice
.as_ref()
.map_or(false, |choice| choice.read(cx).is_enabled())
}
pub fn data_collection_permission(&self, cx: &App) -> bool {
self.choice
.as_ref()
@ -1432,7 +1438,10 @@ impl inline_completion::InlineCompletionProvider for ZetaInlineCompletionProvide
}
fn data_collection_state(&self, cx: &App) -> DataCollectionState {
if self.provider_data_collection.data_collection_permission(cx) {
if self
.provider_data_collection
.user_data_collection_choice(cx)
{
DataCollectionState::Enabled
} else {
DataCollectionState::Disabled