Fix gameLog spam

This commit is contained in:
Natsumi
2021-07-04 06:46:03 +12:00
parent fb14809f08
commit ad9b367b1c
+28 -24
View File
@@ -5683,9 +5683,6 @@ speechSynthesis.getVoices();
if (ctx.state === 'online') { if (ctx.state === 'online') {
var ts = Date.now(); var ts = Date.now();
var time = ts - $location_at; var time = ts - $location_at;
if (location === 'offline') {
location = '';
}
var worldName = await this.getWorldName(location); var worldName = await this.getWorldName(location);
var feed = { var feed = {
created_at: new Date().toJSON(), created_at: new Date().toJSON(),
@@ -5768,15 +5765,17 @@ speechSynthesis.getVoices();
$app.methods.getWorldName = async function (location) { $app.methods.getWorldName = async function (location) {
var worldName = ''; var worldName = '';
try { if (location !== 'offline') {
var L = API.parseLocation(location); try {
if (L.worldId) { var L = API.parseLocation(location);
if (L.worldId) {
var args = await API.getCachedWorld({ var args = await API.getCachedWorld({
worldId: L.worldId worldId: L.worldId
}); });
worldName = args.ref.name; worldName = args.ref.name;
}
} catch (err) {
} }
} catch (err) {
} }
return worldName; return worldName;
}; };
@@ -7172,14 +7171,15 @@ speechSynthesis.getVoices();
}; };
this.friendLogTable.data.push(friendLogHistory); this.friendLogTable.data.push(friendLogHistory);
database.addFriendLogHistory(friendLogHistory); database.addFriendLogHistory(friendLogHistory);
var friendLogCurrent = {
userId: id,
displayName: ctx.displayName,
trustLevel: ctx.trustLevel
};
this.friendLog.set(id, friendLogCurrent);
database.setFriendLogCurrent(friendLogCurrent);
} }
var friendLogCurrent = {
userId: id,
displayName: ctx.displayName,
trustLevel: ctx.trustLevel
};
this.friendLog.set(id, friendLogCurrent);
database.setFriendLogCurrent(friendLogCurrent);
this.notifyMenu('friendLog'); this.notifyMenu('friendLog');
}; };
@@ -7239,6 +7239,13 @@ speechSynthesis.getVoices();
}; };
this.friendLogTable.data.push(friendLogHistory); this.friendLogTable.data.push(friendLogHistory);
database.addFriendLogHistory(friendLogHistory); database.addFriendLogHistory(friendLogHistory);
var friendLogCurrent = {
userId: ref.id,
displayName: ref.displayName,
trustLevel: ref.$trustLevel
};
this.friendLog.set(ref.id, friendLogCurrent);
database.setFriendLogCurrent(friendLogCurrent);
} }
ctx.displayName = ref.displayName; ctx.displayName = ref.displayName;
this.notifyMenu('friendLog'); this.notifyMenu('friendLog');
@@ -7256,20 +7263,17 @@ speechSynthesis.getVoices();
}; };
this.friendLogTable.data.push(friendLogHistory); this.friendLogTable.data.push(friendLogHistory);
database.addFriendLogHistory(friendLogHistory); database.addFriendLogHistory(friendLogHistory);
var friendLogCurrent = {
userId: ref.id,
displayName: ref.displayName,
trustLevel: ref.$trustLevel
};
this.friendLog.set(ref.id, friendLogCurrent);
database.setFriendLogCurrent(friendLogCurrent);
} }
ctx.trustLevel = ref.$trustLevel; ctx.trustLevel = ref.$trustLevel;
this.notifyMenu('friendLog'); this.notifyMenu('friendLog');
} }
if ((ctx.displayName !== ref.displayName) ||
((ref.$trustLevel) && (ctx.trustLevel !== ref.$trustLevel))) {
var friendLogCurrent = {
userId: ref.id,
displayName: ref.displayName,
trustLevel: ref.trustLevel
};
this.friendLog.set(ref.id, friendLogCurrent);
database.setFriendLogCurrent(friendLogCurrent);
}
}; };
$app.methods.deleteFriendLog = function (row) { $app.methods.deleteFriendLog = function (row) {