do not print anything if no user id was found

This commit is contained in:
Irevoire 2021-10-13 19:38:14 +02:00 committed by marin postma
parent f7bb499c28
commit 9e1bba40f7
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9
2 changed files with 6 additions and 2 deletions

View File

@ -182,7 +182,7 @@ impl MockAnalytics {
pub fn new(opt: &Opt) -> &'static Self {
let user = read_to_string(opt.db_path.join("user-id"))
.or_else(|_| read_to_string("/tmp/meilisearch-user-id"))
.unwrap_or_else(|_| "No user-id".to_string());
.unwrap_or_else(|_| "".to_string());
let analytics = Box::new(Self { user });
Box::leak(analytics)
}

View File

@ -126,7 +126,11 @@ Anonymous telemetry: \"Enabled\""
);
}
}
eprintln!("Unique User ID:\t\"{}\"", analytics);
let analytics = analytics.to_string();
if analytics != "" {
eprintln!("Unique User ID:\t\"{}\"", analytics);
}
eprintln!();