Published user time (#1141)

* Adding published time to UserForm.

- Federates user creation time. Fixes #1140

* Check the user published time.
pull/1145/head
Dessalines 2020-09-18 07:04:12 -04:00 committed by GitHub
parent fc525c8144
commit 7bdb1abbe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 21 additions and 1 deletions

View File

@ -25,6 +25,7 @@ function assertUserFederation(
expect(userOne.actor_id).toBe(userTwo.actor_id); expect(userOne.actor_id).toBe(userTwo.actor_id);
expect(userOne.avatar).toBe(userTwo.avatar); expect(userOne.avatar).toBe(userTwo.avatar);
expect(userOne.banner).toBe(userTwo.banner); expect(userOne.banner).toBe(userTwo.banner);
expect(userOne.published).toBe(userTwo.published);
} }
test('Create user', async () => { test('Create user', async () => {

View File

@ -105,6 +105,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -281,6 +281,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -520,6 +520,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -321,6 +321,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -417,6 +417,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),
@ -445,6 +446,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -101,6 +101,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -350,6 +350,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -413,6 +413,7 @@ mod tests {
matrix_user_id: None, matrix_user_id: None,
avatar: None, avatar: None,
banner: None, banner: None,
published: None,
updated: None, updated: None,
admin: false, admin: false,
banned: false, banned: false,

View File

@ -158,6 +158,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),
@ -186,6 +187,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -48,6 +48,7 @@ pub struct UserForm {
pub banned: bool, pub banned: bool,
pub email: Option<Option<String>>, pub email: Option<Option<String>>,
pub avatar: Option<Option<String>>, pub avatar: Option<Option<String>>,
pub published: Option<chrono::NaiveDateTime>,
pub updated: Option<chrono::NaiveDateTime>, pub updated: Option<chrono::NaiveDateTime>,
pub show_nsfw: bool, pub show_nsfw: bool,
pub theme: String, pub theme: String,
@ -181,6 +182,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -97,6 +97,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),
@ -125,6 +126,7 @@ mod tests {
banner: None, banner: None,
admin: false, admin: false,
banned: false, banned: false,
published: None,
updated: None, updated: None,
show_nsfw: false, show_nsfw: false,
theme: "darkly".into(), theme: "darkly".into(),

View File

@ -170,6 +170,7 @@ impl Perform for Register {
banner: None, banner: None,
password_encrypted: data.password.to_owned(), password_encrypted: data.password.to_owned(),
preferred_username: None, preferred_username: None,
published: None,
updated: None, updated: None,
admin: data.admin, admin: data.admin,
banned: false, banned: false,
@ -404,6 +405,7 @@ impl Perform for SaveUserSettings {
banner, banner,
password_encrypted, password_encrypted,
preferred_username, preferred_username,
published: Some(read_user.published),
updated: Some(naive_now()), updated: Some(naive_now()),
admin: read_user.admin, admin: read_user.admin,
banned: read_user.banned, banned: read_user.banned,

View File

@ -262,6 +262,7 @@ impl FromApub for UserForm {
email: None, email: None,
avatar, avatar,
banner, banner,
published: person.inner.published().map(|u| u.to_owned().naive_local()),
updated: person.updated().map(|u| u.to_owned().naive_local()), updated: person.updated().map(|u| u.to_owned().naive_local()),
show_nsfw: false, show_nsfw: false,
theme: "".to_string(), theme: "".to_string(),

View File

@ -54,6 +54,7 @@ fn user_updates_2020_04_02(conn: &PgConnection) -> Result<(), LemmyError> {
banner: Some(cuser.banner.to_owned()), banner: Some(cuser.banner.to_owned()),
password_encrypted: cuser.password_encrypted.to_owned(), password_encrypted: cuser.password_encrypted.to_owned(),
preferred_username: cuser.preferred_username.to_owned(), preferred_username: cuser.preferred_username.to_owned(),
published: Some(cuser.published),
updated: None, updated: None,
admin: cuser.admin, admin: cuser.admin,
banned: cuser.banned, banned: cuser.banned,