ssb: Suppress noisy output when running command-line actions with output intended to be parsed.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled

This commit is contained in:
2025-01-14 21:37:11 -05:00
parent 56c77c781a
commit 250933bf41
7 changed files with 79 additions and 27 deletions

View File

@ -417,9 +417,8 @@ class TfElement extends LitElement {
ON messages.author = following.value
GROUP BY messages.author
`,
[
JSON.stringify(Object.keys(users)),
]);
[JSON.stringify(Object.keys(users))]
);
for (let row of info) {
users[row.author].seq = row.max_seq;
users[row.author].ts = row.max_ts;
@ -459,7 +458,11 @@ class TfElement extends LitElement {
);
start_time = new Date();
users = await this.fetch_user_info(users);
console.log('user info took', (new Date() - start_time) / 1000.0, 'seconds');
console.log(
'user info took',
(new Date() - start_time) / 1000.0,
'seconds'
);
this.users = users;
console.log(
`load finished ${whoami} => ${this.whoami} in ${(new Date() - start_time) / 1000}`
@ -593,7 +596,8 @@ class TfElement extends LitElement {
style="position: static; top: 0; z-index: 10"
>
<button
class=${'w3-bar-item w3-button w3-circle w3-ripple' + (this.connections?.some(x => x.flags.one_shot) ? ' w3-spin' : '')}
class=${'w3-bar-item w3-button w3-circle w3-ripple' +
(this.connections?.some((x) => x.flags.one_shot) ? ' w3-spin' : '')}
style="width: 1.5em; height: 1.5em; padding: 8px"
@click=${this.refresh}
>

View File

@ -587,7 +587,7 @@ class TfMessageElement extends LitElement {
></tf-message>
`
)}
</div>`
</div>`
);
} else if (typeof content?.type === 'string') {
if (content.type == 'about') {

View File

@ -275,8 +275,8 @@ class TfTabNewsFeedElement extends LitElement {
}
merge_messages(old_messages, new_messages) {
let old_by_id = Object.fromEntries(old_messages.map(x => [x.id, x]));
return new_messages.map(x => old_by_id[x.id] ? old_by_id[x.id] : x);
let old_by_id = Object.fromEntries(old_messages.map((x) => [x.id, x]));
return new_messages.map((x) => (old_by_id[x.id] ? old_by_id[x.id] : x));
}
async load_latest() {
@ -298,14 +298,17 @@ class TfTabNewsFeedElement extends LitElement {
} finally {
this.loading--;
}
this.messages = this.merge_messages(this.messages, Object.values(
Object.fromEntries(
[...this.messages, ...messages]
.sort((x, y) => x.timestamp - y.timestamp)
.slice(-1024)
.map((x) => [x.id, x])
this.messages = this.merge_messages(
this.messages,
Object.values(
Object.fromEntries(
[...this.messages, ...messages]
.sort((x, y) => x.timestamp - y.timestamp)
.slice(-1024)
.map((x) => [x.id, x])
)
)
));
);
console.log('done loading latest messages.');
}

View File

@ -137,9 +137,9 @@ class TfTabNewsElement extends LitElement {
suggested_follows() {
/*
** Filter out people who have used future timestamps so that they aren't
** pinned at the top.
*/
** Filter out people who have used future timestamps so that they aren't
** pinned at the top.
*/
let self = this;
return Object.entries(this.users)
.filter((x) => x[1].follow_depth > 1)