mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-30 00:10:20 +00:00
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:
parent
fc525c8144
commit
7bdb1abbe6
15 changed files with 21 additions and 1 deletions
|
@ -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 () => {
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue