Set full_name_opt to None when GECOS data is empty
This commit is contained in:
parent
4ddb320dae
commit
37a96b4b30
3 changed files with 4 additions and 2 deletions
|
|
@ -109,6 +109,7 @@ impl GreeterProxy {
|
||||||
full_name_opt: user
|
full_name_opt: user
|
||||||
.gecos
|
.gecos
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
.filter(|s| !s.is_empty())
|
||||||
.map(|gecos| gecos.split(',').next().unwrap_or_default().to_string()),
|
.map(|gecos| gecos.split(',').next().unwrap_or_default().to_string()),
|
||||||
icon_opt,
|
icon_opt,
|
||||||
theme_opt: None,
|
theme_opt: None,
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ fn user_data_fallback() -> Vec<UserData> {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
full_name_opt: user
|
full_name_opt: user
|
||||||
.gecos
|
.gecos
|
||||||
|
.filter(|s| !s.is_empty())
|
||||||
.map(|gecos| gecos.split(',').next().unwrap_or_default().to_string()),
|
.map(|gecos| gecos.split(',').next().unwrap_or_default().to_string()),
|
||||||
icon_opt,
|
icon_opt,
|
||||||
theme_opt: None,
|
theme_opt: None,
|
||||||
|
|
|
||||||
|
|
@ -642,9 +642,9 @@ impl cosmic::Application for App {
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
match &self.flags.current_user.gecos {
|
match self.flags.current_user.gecos.as_ref().filter(|s| !s.is_empty()) {
|
||||||
Some(gecos) => {
|
Some(gecos) => {
|
||||||
let full_name = gecos.split(",").next().unwrap_or("");
|
let full_name = gecos.split(",").next().unwrap_or_default();
|
||||||
column = column.push(
|
column = column.push(
|
||||||
widget::container(widget::text::title4(full_name))
|
widget::container(widget::text::title4(full_name))
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue