ssb: prettier.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m29s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m29s
This commit is contained in:
@ -72,7 +72,8 @@ class TfElement extends LitElement {
|
||||
}
|
||||
|
||||
async load_channels() {
|
||||
let channels = await tfrpc.rpc.query(`
|
||||
let channels = await tfrpc.rpc.query(
|
||||
`
|
||||
SELECT
|
||||
content ->> 'channel' AS channel,
|
||||
content ->> 'subscribed' AS subscribed
|
||||
@ -82,7 +83,9 @@ class TfElement extends LitElement {
|
||||
author = ? AND
|
||||
content ->> 'type' = 'channel'
|
||||
ORDER BY sequence
|
||||
`, [this.whoami]);
|
||||
`,
|
||||
[this.whoami]
|
||||
);
|
||||
let channel_map = {};
|
||||
for (let row of channels) {
|
||||
if (row.subscribed) {
|
||||
@ -243,7 +246,8 @@ class TfElement extends LitElement {
|
||||
};
|
||||
by_count.push({count: v.of, id: id});
|
||||
}
|
||||
let channels = tfrpc.rpc.query(`
|
||||
let channels = tfrpc.rpc.query(
|
||||
`
|
||||
SELECT channels.value AS channel, MAX(messages.rowid) AS rowid FROM messages
|
||||
JOIN json_each(?1) AS channels ON messages.content ->> 'channel' = channels.value
|
||||
JOIN json_each(?2) AS following ON messages.author = following.value
|
||||
@ -257,12 +261,16 @@ class TfElement extends LitElement {
|
||||
SELECT '@' AS channel, MAX(messages.rowid) AS rowid FROM messages_fts(?3)
|
||||
JOIN messages ON messages.rowid = messages_fts.rowid
|
||||
JOIN json_each(?2) AS following ON messages.author = following.value
|
||||
`, [
|
||||
JSON.stringify(this.channels),
|
||||
JSON.stringify(Object.keys(following)),
|
||||
'"' + this.whoami.replace('"', '""') + '"',
|
||||
]);
|
||||
this.channels_unread = JSON.parse((await tfrpc.rpc.databaseGet('unread')) ?? '{}');
|
||||
`,
|
||||
[
|
||||
JSON.stringify(this.channels),
|
||||
JSON.stringify(Object.keys(following)),
|
||||
'"' + this.whoami.replace('"', '""') + '"',
|
||||
]
|
||||
);
|
||||
this.channels_unread = JSON.parse(
|
||||
(await tfrpc.rpc.databaseGet('unread')) ?? '{}'
|
||||
);
|
||||
let start_time = new Date();
|
||||
users = await this.fetch_about(Object.keys(following).sort(), users);
|
||||
console.log(
|
||||
@ -275,7 +283,9 @@ class TfElement extends LitElement {
|
||||
start_time = new Date();
|
||||
channels = await channels;
|
||||
console.log('channels took', (new Date() - start_time) / 1000.0);
|
||||
this.channels_latest = Object.fromEntries(channels.map(x => [x.channel, x.rowid]));
|
||||
this.channels_latest = Object.fromEntries(
|
||||
channels.map((x) => [x.channel, x.rowid])
|
||||
);
|
||||
this.following = Object.keys(following);
|
||||
this.users = users;
|
||||
console.log(`load finished ${whoami} => ${this.whoami}`);
|
||||
@ -375,7 +385,10 @@ class TfElement extends LitElement {
|
||||
};
|
||||
|
||||
let tabs = html`
|
||||
<div class="w3-bar w3-theme-l1" style="position: sticky; top: 0; z-index: 10">
|
||||
<div
|
||||
class="w3-bar w3-theme-l1"
|
||||
style="position: sticky; top: 0; z-index: 10"
|
||||
>
|
||||
<button
|
||||
class="w3-bar-item w3-button w3-circle w3-ripple"
|
||||
@click=${this.refresh}
|
||||
@ -415,8 +428,7 @@ class TfElement extends LitElement {
|
||||
style="width: 100vw; min-height: 100vh; height: 100%"
|
||||
class="w3-theme-dark"
|
||||
>
|
||||
${tabs}
|
||||
${contents}
|
||||
${tabs} ${contents}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user