mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 12:21:18 +00:00
Moving matrix_user_id to person table. #1438
This commit is contained in:
parent
4b92e35edc
commit
1745b64ceb
26 changed files with 65 additions and 14 deletions
|
@ -543,6 +543,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -550,7 +551,6 @@ mod tests {
|
||||||
let local_user_form = LocalUserForm {
|
let local_user_form = LocalUserForm {
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
email: None,
|
email: None,
|
||||||
matrix_user_id: None,
|
|
||||||
password_encrypted: "123456".to_string(),
|
password_encrypted: "123456".to_string(),
|
||||||
admin: None,
|
admin: None,
|
||||||
show_nsfw: None,
|
show_nsfw: None,
|
||||||
|
|
|
@ -214,6 +214,7 @@ impl Perform for Register {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: Some(generate_inbox_url(&actor_id)?),
|
inbox_url: Some(generate_inbox_url(&actor_id)?),
|
||||||
shared_inbox_url: Some(Some(generate_shared_inbox_url(&actor_id)?)),
|
shared_inbox_url: Some(Some(generate_shared_inbox_url(&actor_id)?)),
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
// insert the person
|
// insert the person
|
||||||
|
@ -232,7 +233,6 @@ impl Perform for Register {
|
||||||
let local_user_form = LocalUserForm {
|
let local_user_form = LocalUserForm {
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
email: Some(data.email.to_owned()),
|
email: Some(data.email.to_owned()),
|
||||||
matrix_user_id: None,
|
|
||||||
password_encrypted: data.password.to_owned(),
|
password_encrypted: data.password.to_owned(),
|
||||||
admin: Some(no_admins),
|
admin: Some(no_admins),
|
||||||
show_nsfw: Some(data.show_nsfw),
|
show_nsfw: Some(data.show_nsfw),
|
||||||
|
@ -477,6 +477,7 @@ impl Perform for SaveUserSettings {
|
||||||
public_key: None,
|
public_key: None,
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
let person_res = blocking(context.pool(), move |conn| {
|
let person_res = blocking(context.pool(), move |conn| {
|
||||||
|
@ -493,7 +494,6 @@ impl Perform for SaveUserSettings {
|
||||||
let local_user_form = LocalUserForm {
|
let local_user_form = LocalUserForm {
|
||||||
person_id,
|
person_id,
|
||||||
email,
|
email,
|
||||||
matrix_user_id,
|
|
||||||
password_encrypted,
|
password_encrypted,
|
||||||
admin: None,
|
admin: None,
|
||||||
show_nsfw: data.show_nsfw,
|
show_nsfw: data.show_nsfw,
|
||||||
|
|
|
@ -187,6 +187,7 @@ impl FromApubToForm<PersonExt> for PersonForm {
|
||||||
last_refreshed_at: Some(naive_now()),
|
last_refreshed_at: Some(naive_now()),
|
||||||
inbox_url: Some(person.inner.inbox()?.to_owned().into()),
|
inbox_url: Some(person.inner.inbox()?.to_owned().into()),
|
||||||
shared_inbox_url: Some(shared_inbox),
|
shared_inbox_url: Some(shared_inbox),
|
||||||
|
matrix_user_id: None, // TODO
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -80,6 +81,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
||||||
|
|
|
@ -63,6 +63,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -84,6 +85,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
||||||
|
|
|
@ -59,6 +59,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -80,6 +81,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
||||||
|
|
|
@ -63,6 +63,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -84,6 +85,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
|
||||||
|
|
|
@ -57,6 +57,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
|
|
@ -153,6 +153,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
|
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
|
||||||
|
|
|
@ -261,6 +261,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
|
|
@ -371,6 +371,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
|
|
@ -25,7 +25,6 @@ mod safe_settings_type {
|
||||||
lang,
|
lang,
|
||||||
show_avatars,
|
show_avatars,
|
||||||
send_notifications_to_email,
|
send_notifications_to_email,
|
||||||
matrix_user_id,
|
|
||||||
validator_time,
|
validator_time,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@ mod safe_settings_type {
|
||||||
lang,
|
lang,
|
||||||
show_avatars,
|
show_avatars,
|
||||||
send_notifications_to_email,
|
send_notifications_to_email,
|
||||||
matrix_user_id,
|
|
||||||
validator_time,
|
validator_time,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,6 +224,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_mod = Person::create(&conn, &new_mod).unwrap();
|
let inserted_mod = Person::create(&conn, &new_mod).unwrap();
|
||||||
|
@ -245,6 +246,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
|
|
@ -110,6 +110,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -118,7 +119,6 @@ mod tests {
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
password_encrypted: "pass".to_string(),
|
password_encrypted: "pass".to_string(),
|
||||||
email: None,
|
email: None,
|
||||||
matrix_user_id: None,
|
|
||||||
admin: None,
|
admin: None,
|
||||||
show_nsfw: None,
|
show_nsfw: None,
|
||||||
theme: None,
|
theme: None,
|
||||||
|
|
|
@ -27,6 +27,7 @@ mod safe_type {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl ToSafe for Person {
|
impl ToSafe for Person {
|
||||||
|
@ -47,6 +48,7 @@ mod safe_type {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +73,7 @@ mod safe_type_alias_1 {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl ToSafe for PersonAlias1 {
|
impl ToSafe for PersonAlias1 {
|
||||||
|
@ -91,6 +94,7 @@ mod safe_type_alias_1 {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +119,7 @@ mod safe_type_alias_2 {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl ToSafe for PersonAlias2 {
|
impl ToSafe for PersonAlias2 {
|
||||||
|
@ -135,6 +140,7 @@ mod safe_type_alias_2 {
|
||||||
deleted,
|
deleted,
|
||||||
inbox_url,
|
inbox_url,
|
||||||
shared_inbox_url,
|
shared_inbox_url,
|
||||||
|
matrix_user_id,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,16 +218,14 @@ impl Person_ for Person {
|
||||||
|
|
||||||
// Set the local user info to none
|
// Set the local user info to none
|
||||||
diesel::update(local_user::table.filter(local_user::person_id.eq(person_id)))
|
diesel::update(local_user::table.filter(local_user::person_id.eq(person_id)))
|
||||||
.set((
|
.set((local_user::email.eq::<Option<String>>(None),))
|
||||||
local_user::email.eq::<Option<String>>(None),
|
|
||||||
local_user::matrix_user_id.eq::<Option<String>>(None),
|
|
||||||
))
|
|
||||||
.execute(conn)?;
|
.execute(conn)?;
|
||||||
|
|
||||||
diesel::update(person.find(person_id))
|
diesel::update(person.find(person_id))
|
||||||
.set((
|
.set((
|
||||||
preferred_username.eq::<Option<String>>(None),
|
preferred_username.eq::<Option<String>>(None),
|
||||||
bio.eq::<Option<String>>(None),
|
bio.eq::<Option<String>>(None),
|
||||||
|
matrix_user_id.eq::<Option<String>>(None),
|
||||||
deleted.eq(true),
|
deleted.eq(true),
|
||||||
updated.eq(naive_now()),
|
updated.eq(naive_now()),
|
||||||
))
|
))
|
||||||
|
@ -254,6 +258,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -276,6 +281,7 @@ mod tests {
|
||||||
last_refreshed_at: inserted_person.published,
|
last_refreshed_at: inserted_person.published,
|
||||||
inbox_url: inserted_person.inbox_url.to_owned(),
|
inbox_url: inserted_person.inbox_url.to_owned(),
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let read_person = Person::read(&conn, inserted_person.id).unwrap();
|
let read_person = Person::read(&conn, inserted_person.id).unwrap();
|
||||||
|
|
|
@ -105,6 +105,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -126,6 +127,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
|
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
|
||||||
|
|
|
@ -288,6 +288,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
|
|
@ -165,6 +165,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
|
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
|
||||||
|
@ -186,6 +187,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
|
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
|
||||||
|
|
|
@ -154,7 +154,6 @@ table! {
|
||||||
lang -> Varchar,
|
lang -> Varchar,
|
||||||
show_avatars -> Bool,
|
show_avatars -> Bool,
|
||||||
send_notifications_to_email -> Bool,
|
send_notifications_to_email -> Bool,
|
||||||
matrix_user_id -> Nullable<Text>,
|
|
||||||
validator_time -> Timestamp,
|
validator_time -> Timestamp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,6 +286,7 @@ table! {
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
shared_inbox_url -> Nullable<Varchar>,
|
shared_inbox_url -> Nullable<Varchar>,
|
||||||
|
matrix_user_id -> Nullable<Text>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,6 +485,7 @@ table! {
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
shared_inbox_url -> Nullable<Varchar>,
|
shared_inbox_url -> Nullable<Varchar>,
|
||||||
|
matrix_user_id -> Nullable<Text>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,6 +508,7 @@ table! {
|
||||||
deleted -> Bool,
|
deleted -> Bool,
|
||||||
inbox_url -> Varchar,
|
inbox_url -> Varchar,
|
||||||
shared_inbox_url -> Nullable<Varchar>,
|
shared_inbox_url -> Nullable<Varchar>,
|
||||||
|
matrix_user_id -> Nullable<Text>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ pub struct LocalUser {
|
||||||
pub lang: String,
|
pub lang: String,
|
||||||
pub show_avatars: bool,
|
pub show_avatars: bool,
|
||||||
pub send_notifications_to_email: bool,
|
pub send_notifications_to_email: bool,
|
||||||
pub matrix_user_id: Option<String>,
|
|
||||||
pub validator_time: chrono::NaiveDateTime,
|
pub validator_time: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +34,6 @@ pub struct LocalUserForm {
|
||||||
pub lang: Option<String>,
|
pub lang: Option<String>,
|
||||||
pub show_avatars: Option<bool>,
|
pub show_avatars: Option<bool>,
|
||||||
pub send_notifications_to_email: Option<bool>,
|
pub send_notifications_to_email: Option<bool>,
|
||||||
pub matrix_user_id: Option<Option<String>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A local user view that removes password encrypted
|
/// A local user view that removes password encrypted
|
||||||
|
@ -53,6 +51,5 @@ pub struct LocalUserSettings {
|
||||||
pub lang: String,
|
pub lang: String,
|
||||||
pub show_avatars: bool,
|
pub show_avatars: bool,
|
||||||
pub send_notifications_to_email: bool,
|
pub send_notifications_to_email: bool,
|
||||||
pub matrix_user_id: Option<String>,
|
|
||||||
pub validator_time: chrono::NaiveDateTime,
|
pub validator_time: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ pub struct Person {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A safe representation of person, without the sensitive info
|
/// A safe representation of person, without the sensitive info
|
||||||
|
@ -45,6 +46,7 @@ pub struct PersonSafe {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
|
@ -67,6 +69,7 @@ pub struct PersonAlias1 {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
|
@ -86,6 +89,7 @@ pub struct PersonSafeAlias1 {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
|
@ -108,6 +112,7 @@ pub struct PersonAlias2 {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
|
@ -127,6 +132,7 @@ pub struct PersonSafeAlias2 {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
pub shared_inbox_url: Option<DbUrl>,
|
pub shared_inbox_url: Option<DbUrl>,
|
||||||
|
pub matrix_user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset, Clone)]
|
||||||
|
@ -148,4 +154,5 @@ pub struct PersonForm {
|
||||||
pub deleted: Option<bool>,
|
pub deleted: Option<bool>,
|
||||||
pub inbox_url: Option<DbUrl>,
|
pub inbox_url: Option<DbUrl>,
|
||||||
pub shared_inbox_url: Option<Option<DbUrl>>,
|
pub shared_inbox_url: Option<Option<DbUrl>>,
|
||||||
|
pub matrix_user_id: Option<Option<String>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,6 +469,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -581,6 +582,7 @@ mod tests {
|
||||||
updated: None,
|
updated: None,
|
||||||
inbox_url: inserted_person.inbox_url.to_owned(),
|
inbox_url: inserted_person.inbox_url.to_owned(),
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
},
|
},
|
||||||
recipient: None,
|
recipient: None,
|
||||||
post: Post {
|
post: Post {
|
||||||
|
|
|
@ -469,6 +469,7 @@ mod tests {
|
||||||
last_refreshed_at: None,
|
last_refreshed_at: None,
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
||||||
|
@ -596,6 +597,7 @@ mod tests {
|
||||||
updated: None,
|
updated: None,
|
||||||
inbox_url: inserted_person.inbox_url.to_owned(),
|
inbox_url: inserted_person.inbox_url.to_owned(),
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
},
|
},
|
||||||
creator_banned_from_community: false,
|
creator_banned_from_community: false,
|
||||||
community: CommunitySafe {
|
community: CommunitySafe {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
alter table local_user add column matrix_user_id text;
|
||||||
|
|
||||||
|
update local_user lu
|
||||||
|
set matrix_user_id = p.matrix_user_id
|
||||||
|
from person p
|
||||||
|
where p.id = lu.person_id;
|
||||||
|
|
||||||
|
alter table person drop column matrix_user_id;
|
|
@ -0,0 +1,8 @@
|
||||||
|
alter table person add column matrix_user_id text;
|
||||||
|
|
||||||
|
update person p
|
||||||
|
set matrix_user_id = lu.matrix_user_id
|
||||||
|
from local_user lu
|
||||||
|
where p.id = lu.person_id;
|
||||||
|
|
||||||
|
alter table local_user drop column matrix_user_id;
|
|
@ -70,6 +70,7 @@ fn user_updates_2020_04_02(conn: &PgConnection) -> Result<(), LemmyError> {
|
||||||
last_refreshed_at: Some(naive_now()),
|
last_refreshed_at: Some(naive_now()),
|
||||||
inbox_url: None,
|
inbox_url: None,
|
||||||
shared_inbox_url: None,
|
shared_inbox_url: None,
|
||||||
|
matrix_user_id: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
Person::update(&conn, cperson.id, &form)?;
|
Person::update(&conn, cperson.id, &form)?;
|
||||||
|
|
Loading…
Reference in a new issue