add: user last_policy_consent

This commit is contained in:
trisua 2025-08-13 02:22:00 -04:00
parent befd9096b1
commit 2edef9bd35
11 changed files with 107 additions and 9 deletions

View file

@ -104,6 +104,9 @@ pub struct User {
/// The IDs of products to be applied to the user's profile.
#[serde(default)]
pub applied_configurations: Vec<(AppliedConfigType, usize)>,
/// The time in which the user last consented to the site's policies.
#[serde(default)]
pub last_policy_consent: usize,
}
pub type UserConnections =
@ -180,8 +183,6 @@ impl Default for DefaultProfileTabChoice {
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct UserSettings {
#[serde(default)]
pub policy_consent: bool,
#[serde(default)]
pub display_name: String,
#[serde(default)]
@ -391,10 +392,11 @@ impl User {
pub fn new(username: String, password: String) -> Self {
let salt = salt();
let password = hash_salted(password, salt.clone());
let created = unix_epoch_timestamp();
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp(),
created,
username,
password,
salt,
@ -405,7 +407,7 @@ impl User {
notification_count: 0,
follower_count: 0,
following_count: 0,
last_seen: unix_epoch_timestamp(),
last_seen: created,
totp: String::new(),
recovery_codes: Vec::new(),
post_count: 0,
@ -427,6 +429,7 @@ impl User {
coins: 0,
checkouts: Vec::new(),
applied_configurations: Vec::new(),
last_policy_consent: created,
}
}