feat: 外部のサーバでも最終更新時刻からオンライン状況を推定
This commit is contained in:
parent
46e5192de1
commit
9132e2c701
@ -376,8 +376,9 @@ export class UserEntityService implements OnModuleInit {
|
||||
@bindThis
|
||||
public getOnlineStatus(user: MiUser): 'unknown' | 'online' | 'active' | 'offline' {
|
||||
if (user.hideOnlineStatus) return 'unknown';
|
||||
if (user.lastActiveDate == null) return 'unknown';
|
||||
const elapsed = Date.now() - user.lastActiveDate.getTime();
|
||||
const activeDate = user.lastActiveDate ?? user.updatedAt
|
||||
if (activeDate == null) return 'unknown';
|
||||
const elapsed = Date.now() - activeDate.getTime();
|
||||
return (
|
||||
elapsed < USER_ONLINE_THRESHOLD ? 'online' :
|
||||
elapsed < USER_ACTIVE_THRESHOLD ? 'active' :
|
||||
|
Loading…
Reference in New Issue
Block a user