update user ref to be offline when user goes offline

This commit is contained in:
Natsumi
2021-05-26 22:06:52 +12:00
parent adb4a3512e
commit d90c3c7a34

View File

@@ -5355,16 +5355,20 @@ speechSynthesis.getVoices();
(ctx.state === 'online')) {
ctx.ref.$online_for = '';
ctx.ref.$offline_for = Date.now();
if (ctx.state === 'online') {
var ts = Date.now();
var time = ts - ctx.ref.$location_at;
this.addFeed('Offline', ctx.ref, {
location: (ctx.ref.location === 'offline') ? '' : ctx.ref.location,
time: time
if (ctx.state === 'online') {
var ts = Date.now();
var time = ts - ctx.ref.$location_at;
API.getUser({
userId: id
});
this.addFeed('Offline', ctx.ref, {
location: (ctx.ref.location === 'offline') ? '' : ctx.ref.location,
time: time
});
}
}
if ((state === 'online')) {
if (state === 'online') {
ctx.ref.$location_at = Date.now();
ctx.ref.$online_for = Date.now();
ctx.ref.$offline_for = '';