]> Untitled Git - lemmy.git/commitdiff
Published user time (#1141)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 18 Sep 2020 11:04:12 +0000 (07:04 -0400)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 11:04:12 +0000 (11:04 +0000)
* Adding published time to UserForm.

- Federates user creation time. Fixes #1140

* Check the user published time.

15 files changed:
api_tests/src/user.spec.ts
lemmy_db/src/activity.rs
lemmy_db/src/comment.rs
lemmy_db/src/comment_view.rs
lemmy_db/src/community.rs
lemmy_db/src/moderator.rs
lemmy_db/src/password_reset_request.rs
lemmy_db/src/post.rs
lemmy_db/src/post_view.rs
lemmy_db/src/private_message.rs
lemmy_db/src/user.rs
lemmy_db/src/user_mention.rs
src/api/user.rs
src/apub/user.rs
src/code_migrations.rs

index a1f8c119a5c2580e015f7bf1f9840e729d61536f..bfd56fcbd750a67862e605f141fa2babc568522b 100644 (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);
-});
\ No newline at end of file
+});
index 79b185fb74fa225aaf259faac255854a7cfcdd5b..c3f0ab679728a084720228527198460686c78f06 100644 (file)
@@ -105,6 +105,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index bc2a574ec821a1dc68b97c4bf84de4a0283b7b66..398ea78bf40c624e60af1939d2ce526d31a1240a 100644 (file)
@@ -281,6 +281,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index a5eb8e6d4fd11533c2e9de92c222c341a39b925c..a3358ac43ce5519fcaab1e3d54b65257302f6ff7 100644 (file)
@@ -520,6 +520,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index 918d44f1519aa94e1bbbc6f19bb6c2136bf4a4e6..25cb272a73b42efd6a448be06ad3a7c0ea7efe73 100644 (file)
@@ -321,6 +321,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index aaed1314d7d33083820c8f81afb156dc2b2ebb67..3edd4350f3732cdd4dd95ebb806a832e278103ad 100644 (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(),
index fde47c98e99361ae9314d01bd3d9ce2f2a6f2de2..8a831a8db9f8ce95d94078f151763a3a18dee9e7 100644 (file)
@@ -101,6 +101,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index 7d13eb806801d28a3bd54ba2cef3c810bc562c0e..724c342c67c4aeefa686e4665090697e9bf2ecd6 100644 (file)
@@ -350,6 +350,7 @@ mod tests {
       banner: None,
       admin: false,
       banned: false,
+      published: None,
       updated: None,
       show_nsfw: false,
       theme: "darkly".into(),
index e88a80e306445c70c19004af875106bf59458af9..8f606b2263b496808594d0276048393ca36078ee 100644 (file)
@@ -413,6 +413,7 @@ mod tests {
       matrix_user_id: None,
       avatar: None,
       banner: None,
+      published: None,
       updated: None,
       admin: false,
       banned: false,
index 2484ebeabd13b9f0c6b6f5c7db63a77cc10d6991..988d97d3b69b8b139b91e6ab4b751db05082219d 100644 (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(),
index 986701c4387be6b655abea066ca84000d8bf5271..f2c20e9474455683a85543e5717c6770acfda325 100644 (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(),
index bcb3a1437bd06f51c26c5875e716143d925c69d7..f35722cf9c098538164b9cf05051af20aace4c82 100644 (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(),
index 630f816deaa3e3bc94862e99b9de073cebaf2306..977250d34fdf2db8ff0847c7002b1601569dbb91 100644 (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,
index fb650632e9cd6f4bb7f90758c14335ca09cd6d01..47b6a58a71ade4f555c6973a527ddbf976996a49 100644 (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(),
index 47d046696130c9052e248c128c13b5dc5befc39b..6a69035daba9972ab09773432107a6429f07c312 100644 (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,