edit predictions: Show user if current project is open source (#24587)

Release Notes:

- N/A

---------

Co-authored-by: João Marcos <marcospb19@hotmail.com>
This commit is contained in:
Danilo Leal 2025-02-10 22:28:56 -03:00 committed by GitHub
parent 3d9f70946c
commit c89ad65782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 86 additions and 31 deletions

View file

@ -25,18 +25,30 @@ pub enum DataCollectionState {
/// The provider doesn't support data collection.
Unsupported,
/// Data collection is enabled.
Enabled,
Enabled { is_project_open_source: bool },
/// Data collection is disabled or unanswered.
Disabled,
Disabled { is_project_open_source: bool },
}
impl DataCollectionState {
pub fn is_supported(&self) -> bool {
!matches!(self, DataCollectionState::Unsupported)
!matches!(self, DataCollectionState::Unsupported { .. })
}
pub fn is_enabled(&self) -> bool {
matches!(self, DataCollectionState::Enabled)
matches!(self, DataCollectionState::Enabled { .. })
}
pub fn is_project_open_source(&self) -> bool {
match self {
Self::Enabled {
is_project_open_source,
}
| Self::Disabled {
is_project_open_source,
} => *is_project_open_source,
_ => false,
}
}
}