GDPR export route (#969)

* GDPR export route

* make users able to access
This commit is contained in:
Geometrically
2024-09-27 12:43:17 -07:00
committed by GitHub
parent f7d1cd2a4f
commit 28b6bf8603
20 changed files with 417 additions and 163 deletions

View File

@@ -113,19 +113,25 @@ impl Thread {
true
}
})
.map(|x| ThreadMessage {
id: x.id.into(),
author_id: if x.hide_identity && !user.role.is_mod() {
None
} else {
x.author_id.map(|x| x.into())
},
body: x.body,
created: x.created,
hide_identity: x.hide_identity,
})
.map(|x| ThreadMessage::from(x, user))
.collect(),
members: users,
}
}
}
impl ThreadMessage {
pub fn from(data: crate::database::models::ThreadMessage, user: &User) -> Self {
Self {
id: data.id.into(),
author_id: if data.hide_identity && !user.role.is_mod() {
None
} else {
data.author_id.map(|x| x.into())
},
body: data.body,
created: data.created,
hide_identity: data.hide_identity,
}
}
}