mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-05 00:15:03 +03:00
send user info to sentry
This commit is contained in:
parent
93975be057
commit
4d3f64d6d9
@ -89,6 +89,9 @@ fn set_user(handle: tauri::AppHandle, user: users::User) -> Result<(), Error> {
|
||||
message: "Failed to save user".to_string(),
|
||||
}
|
||||
})?;
|
||||
|
||||
sentry::configure_scope(|scope| scope.set_user(Some(user.clone().into())));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -104,6 +107,9 @@ fn delete_user(handle: tauri::AppHandle) -> Result<(), Error> {
|
||||
message: "Failed to delete user".to_string(),
|
||||
}
|
||||
})?;
|
||||
|
||||
sentry::configure_scope(|scope| scope.set_user(None));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -402,6 +408,17 @@ fn main() {
|
||||
users_storage.clone(),
|
||||
);
|
||||
|
||||
users_storage
|
||||
.get()
|
||||
.and_then(|user| match user {
|
||||
Some(user) => {
|
||||
sentry::configure_scope(|scope| scope.set_user(Some(user.clone().into())));
|
||||
Ok(())
|
||||
}
|
||||
None => Ok(()),
|
||||
})
|
||||
.expect("Failed to set user");
|
||||
|
||||
let (tx, rx): (mpsc::Sender<events::Event>, mpsc::Receiver<events::Event>) =
|
||||
mpsc::channel();
|
||||
|
||||
|
@ -11,3 +11,14 @@ pub struct User {
|
||||
pub updated_at: String,
|
||||
pub access_token: String,
|
||||
}
|
||||
|
||||
impl Into<sentry::User> for User {
|
||||
fn into(self) -> sentry::User {
|
||||
sentry::User {
|
||||
id: Some(self.id.to_string()),
|
||||
username: Some(self.name),
|
||||
email: Some(self.email),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user