From 200e6487722b1dac08337f8fc25d106652c8f3c0 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 5 Mar 2025 15:40:13 +0100 Subject: [PATCH] fix(backend): update User.LastActive in more places --- Foxnouns.Backend/Controllers/MembersController.cs | 6 ++++++ Foxnouns.Backend/Controllers/UsersController.cs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Foxnouns.Backend/Controllers/MembersController.cs b/Foxnouns.Backend/Controllers/MembersController.cs index bc35f62..635dab9 100644 --- a/Foxnouns.Backend/Controllers/MembersController.cs +++ b/Foxnouns.Backend/Controllers/MembersController.cs @@ -121,6 +121,9 @@ public class MembersController( CurrentUser!.Id ); + CurrentUser.LastActive = clock.GetCurrentInstant(); + db.Update(CurrentUser); + try { await db.SaveChangesAsync(ct); @@ -238,6 +241,9 @@ public class MembersController( MemberAvatarUpdateJob.Enqueue(new AvatarUpdatePayload(member.Id, req.Avatar)); } + CurrentUser.LastActive = clock.GetCurrentInstant(); + db.Update(CurrentUser); + try { await db.SaveChangesAsync(); diff --git a/Foxnouns.Backend/Controllers/UsersController.cs b/Foxnouns.Backend/Controllers/UsersController.cs index 787ff66..48a42aa 100644 --- a/Foxnouns.Backend/Controllers/UsersController.cs +++ b/Foxnouns.Backend/Controllers/UsersController.cs @@ -178,6 +178,8 @@ public class UsersController( UserAvatarUpdateJob.Enqueue(new AvatarUpdatePayload(CurrentUser!.Id, req.Avatar)); } + user.LastActive = clock.GetCurrentInstant(); + try { await db.SaveChangesAsync(ct); @@ -253,6 +255,7 @@ public class UsersController( } user.CustomPreferences = preferences; + user.LastActive = clock.GetCurrentInstant(); await db.SaveChangesAsync(ct); return Ok(user.CustomPreferences); @@ -280,6 +283,7 @@ public class UsersController( if (req.HasProperty(nameof(req.DarkMode))) user.Settings.DarkMode = req.DarkMode; + user.LastActive = clock.GetCurrentInstant(); db.Update(user); await db.SaveChangesAsync(ct);