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
+4
View File
@@ -5358,6 +5358,9 @@ speechSynthesis.getVoices();
if (ctx.state === 'online') { if (ctx.state === 'online') {
var ts = Date.now(); var ts = Date.now();
var time = ts - ctx.ref.$location_at; var time = ts - ctx.ref.$location_at;
API.getUser({
userId: id
});
this.addFeed('Offline', ctx.ref, { this.addFeed('Offline', ctx.ref, {
location: (ctx.ref.location === 'offline') ? '' : ctx.ref.location, location: (ctx.ref.location === 'offline') ? '' : ctx.ref.location,
time: time time: time
@@ -5365,6 +5368,7 @@ speechSynthesis.getVoices();
} }
} }
if ((state === 'online')) { if ((state === 'online')) {
if (state === 'online') {
ctx.ref.$location_at = Date.now(); ctx.ref.$location_at = Date.now();
ctx.ref.$online_for = Date.now(); ctx.ref.$online_for = Date.now();
ctx.ref.$offline_for = ''; ctx.ref.$offline_for = '';