fix: Current user last active at (#11957)

* fix: Last active timestamp should always read as now for current user

* Shorten language on members table
This commit is contained in:
Tom Moor
2026-04-04 12:28:16 -04:00
committed by GitHub
parent b9c9dc4127
commit 741f6c07d2
2 changed files with 18 additions and 2 deletions
+17 -1
View File
@@ -58,7 +58,23 @@ class User extends ParanoidModel implements Searchable {
role: UserRole;
@observable
lastActiveAt: string;
protected _lastActiveAt: string;
/**
* The last time the user was active. For the currently signed-in user, this
* always returns the current date so they always appear as recently active.
*/
@computed
get lastActiveAt(): string {
if (this.store.rootStore.auth?.currentUserId === this.id) {
return new Date(now(60000)).toISOString();
}
return this._lastActiveAt;
}
set lastActiveAt(value: string) {
this._lastActiveAt = value;
}
@observable
isSuspended: boolean;
@@ -110,7 +110,7 @@ export function MembersTable({ canManage, ...rest }: Props) {
accessor: (user) => user.lastActiveAt,
component: (user) =>
user.lastActiveAt ? (
<Time dateTime={user.lastActiveAt} addSuffix />
<Time dateTime={user.lastActiveAt} addSuffix shorten />
) : null,
width: "2fr",
},