From ebaf3224fdda7caf229fd1c59491c2d0b7faea96 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 21 Jun 2022 16:07:59 +0200 Subject: [PATCH] Exclude staff from activity recording --- crates/collab/src/rpc.rs | 7 ++++--- crates/collab/src/rpc/store.rs | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 28b0e61742..7ce0fd840a 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -314,9 +314,10 @@ impl Server { |(project_id, project)| { project.guests.values().chain([&project.host]).filter_map( |collaborator| { - if collaborator - .last_activity - .map_or(false, |activity| activity > period_start) + if !collaborator.admin + && collaborator + .last_activity + .map_or(false, |activity| activity > period_start) { Some((collaborator.user_id, *project_id)) } else { diff --git a/crates/collab/src/rpc/store.rs b/crates/collab/src/rpc/store.rs index 437cd8acc2..561b7c6ab4 100644 --- a/crates/collab/src/rpc/store.rs +++ b/crates/collab/src/rpc/store.rs @@ -52,6 +52,7 @@ pub struct Collaborator { pub user_id: UserId, #[serde(skip)] pub last_activity: Option, + pub admin: bool, } #[derive(Default, Serialize)] @@ -340,6 +341,7 @@ impl Store { user_id: connection.user_id, replica_id: 0, last_activity: None, + admin: connection.admin, }, guests: Default::default(), join_requests: Default::default(), @@ -541,6 +543,7 @@ impl Store { replica_id, user_id: requester_id, last_activity: Some(OffsetDateTime::now_utc()), + admin: requester_connection.admin, }, ); receipts_with_replica_ids.push((receipt, replica_id));