Exclude staff from activity recording

This commit is contained in:
Antonio Scandurra 2022-06-21 16:07:59 +02:00
parent c90e8c08a6
commit ebaf3224fd
2 changed files with 7 additions and 3 deletions

View file

@ -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 {

View file

@ -52,6 +52,7 @@ pub struct Collaborator {
pub user_id: UserId,
#[serde(skip)]
pub last_activity: Option<OffsetDateTime>,
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));