Published user time (#1141)

* Adding published time to UserForm.

- Federates user creation time. Fixes #1140

* Check the user published time.
This commit is contained in:
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.avatar).toBe(userTwo.avatar);
expect(userOne.banner).toBe(userTwo.banner);
expect(userOne.published).toBe(userTwo.published);
}
test('Create user', async () => {
@ -74,4 +75,4 @@ test('Set avatar and banner, check that they are federated', async () => {
let searchBeta = await searchForUser(beta, apShortname);
let userOnBeta = searchBeta.users[0];
assertUserFederation(userOnAlpha, userOnBeta);
});
});

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -262,6 +262,7 @@ impl FromApub for UserForm {
email: None,
avatar,
banner,
published: person.inner.published().map(|u| u.to_owned().naive_local()),
updated: person.updated().map(|u| u.to_owned().naive_local()),
show_nsfw: false,
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()),
password_encrypted: cuser.password_encrypted.to_owned(),
preferred_username: cuser.preferred_username.to_owned(),
published: Some(cuser.published),
updated: None,
admin: cuser.admin,
banned: cuser.banned,