ssb: Reduce redundant queries.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m1s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m1s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "tildefriends-app",
|
||||
"emoji": "🦀",
|
||||
"previous": "&h2f5ZDN1srctuCbTXvXbNwcs2KnRDbk10DlIdZePnXo=.sha256"
|
||||
"previous": "&k075s5Ij+NjRS52GJ6AD8Pl2ZGNseuj63AKBeV4LMQg=.sha256"
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ class TfElement extends LitElement {
|
||||
),
|
||||
])
|
||||
).flat();
|
||||
let latest = {};
|
||||
let latest = {'🔐': undefined};
|
||||
for (let row of channels) {
|
||||
if (!latest[row.channel]) {
|
||||
latest[row.channel] = row.rowid;
|
||||
@@ -506,14 +506,13 @@ class TfElement extends LitElement {
|
||||
let self = this;
|
||||
start_time = new Date();
|
||||
latest_private.then(async function (latest) {
|
||||
let grouped = await self.group_private_messages(latest[1]);
|
||||
self.channels_latest = Object.assign({}, self.channels_latest, {
|
||||
'🔐': latest[0],
|
||||
});
|
||||
console.log('private took', (new Date() - start_time) / 1000.0);
|
||||
self.private_messages = latest[1];
|
||||
self.grouped_private_messages = await self.group_private_messages(
|
||||
latest[1]
|
||||
);
|
||||
self.grouped_private_messages = grouped;
|
||||
console.log('private took', (new Date() - start_time) / 1000.0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -395,9 +395,10 @@ class TfTabNewsFeedElement extends LitElement {
|
||||
this._messages_hash = this.hash;
|
||||
}
|
||||
this._messages_following = JSON.stringify(this.following);
|
||||
this._private_messages =
|
||||
JSON.stringify(this.private_messages) +
|
||||
JSON.stringify(this.grouped_private_messages);
|
||||
this._private_messages = JSON.stringify([
|
||||
this.private_messages,
|
||||
this.grouped_private_messages,
|
||||
]);
|
||||
this._channels_latest = JSON.stringify(
|
||||
Object.keys(this.channels_latest ?? {})
|
||||
);
|
||||
@@ -475,13 +476,15 @@ class TfTabNewsFeedElement extends LitElement {
|
||||
this._messages_hash !== this.hash ||
|
||||
this._messages_following !== JSON.stringify(this.following) ||
|
||||
this._private_messages !==
|
||||
JSON.stringify(this.private_messages) +
|
||||
JSON.stringify(this.grouped_private_messages) ||
|
||||
JSON.stringify([
|
||||
this.private_messages,
|
||||
this.grouped_private_messages,
|
||||
]) ||
|
||||
this._channels_latest !==
|
||||
JSON.stringify(Object.keys(this.channels_latest))
|
||||
) {
|
||||
console.log(
|
||||
`loading messages for ${this.whoami} (following ${this.following.length})`
|
||||
`loading messages for ${this.whoami} (messages=${!this.messages},${this._messages_hash != this.hash} following=${this._messages_following !== JSON.stringify(this.following)}, channels=${this._channels_latest !== JSON.stringify(Object.keys(this.channels_latest))}, private=${this._private_messages !== JSON.stringify([this.private_messages, this.grouped_private_messages])},${this.private_messages?.length},${Object.keys(this.grouped_private_messages ?? {}).length})`
|
||||
);
|
||||
this.load_messages();
|
||||
}
|
||||
|
||||
@@ -337,7 +337,10 @@ async function getProcessBlob(blobId, key, options) {
|
||||
};
|
||||
if (process.credentials?.permissions?.administration) {
|
||||
imports.core.globalSettingsSet = async function (key, value) {
|
||||
await imports.core.permissionTest('set_global_setting', `Set ${JSON.stringify(key)} to ${JSON.stringify(value)}.`);
|
||||
await imports.core.permissionTest(
|
||||
'set_global_setting',
|
||||
`Set ${JSON.stringify(key)} to ${JSON.stringify(value)}.`
|
||||
);
|
||||
print('Setting', key, value);
|
||||
let settings = await loadSettings();
|
||||
settings[key] = value;
|
||||
|
||||
Reference in New Issue
Block a user