ssb: Bring back the updating date while loading.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 15m54s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 15m54s
This commit is contained in:
parent
1c0964753b
commit
1dbf162a71
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🐌",
|
"emoji": "🐌",
|
||||||
"previous": "&LjDy/+vpRFc6dXPOk/+kjlppVMLmKaB6TIZS3WHqoQ8=.sha256"
|
"previous": "&/JTE4AwvZ1kkbPJne84iMDwbvxsJHJxvX8n+GSlqRPc=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,6 @@ class TfElement extends LitElement {
|
|||||||
UNION
|
UNION
|
||||||
SELECT '' AS channel, MAX(messages.rowid) AS rowid FROM messages
|
SELECT '' AS channel, MAX(messages.rowid) AS rowid FROM messages
|
||||||
JOIN json_each(?2) AS following ON messages.author = following.value
|
JOIN json_each(?2) AS following ON messages.author = following.value
|
||||||
WHERE messages.content ->> 'type' = 'post'
|
|
||||||
UNION
|
UNION
|
||||||
SELECT '@' AS channel, MAX(messages.rowid) AS rowid FROM messages_fts(?3)
|
SELECT '@' AS channel, MAX(messages.rowid) AS rowid FROM messages_fts(?3)
|
||||||
JOIN messages ON messages.rowid = messages_fts.rowid
|
JOIN messages ON messages.rowid = messages_fts.rowid
|
||||||
|
@ -15,6 +15,7 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
channels_unread: {type: Object},
|
channels_unread: {type: Object},
|
||||||
loading: {type: Number},
|
loading: {type: Number},
|
||||||
time_range: {type: Array},
|
time_range: {type: Array},
|
||||||
|
time_loading: {type: Array},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
this.channels_unread = {};
|
this.channels_unread = {};
|
||||||
this.start_time = new Date().valueOf();
|
this.start_time = new Date().valueOf();
|
||||||
this.time_range = [0, 0];
|
this.time_range = [0, 0];
|
||||||
|
this.time_loading = undefined;
|
||||||
this.loading = 0;
|
this.loading = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +44,10 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetch_messages(start_time, end_time) {
|
async fetch_messages(start_time, end_time) {
|
||||||
|
this.time_loading = [start_time, end_time];
|
||||||
|
let result;
|
||||||
if (this.hash == '#@') {
|
if (this.hash == '#@') {
|
||||||
let r = await tfrpc.rpc.query(
|
result = await tfrpc.rpc.query(
|
||||||
`
|
`
|
||||||
SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
||||||
FROM messages_fts(?1)
|
FROM messages_fts(?1)
|
||||||
@ -62,9 +66,8 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
end_time,
|
end_time,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
return r;
|
|
||||||
} else if (this.hash.startsWith('#@')) {
|
} else if (this.hash.startsWith('#@')) {
|
||||||
let r = await tfrpc.rpc.query(
|
result = await tfrpc.rpc.query(
|
||||||
`
|
`
|
||||||
WITH mine AS (SELECT rowid, id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
WITH mine AS (SELECT rowid, id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
||||||
FROM messages
|
FROM messages
|
||||||
@ -82,9 +85,8 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
`,
|
`,
|
||||||
[this.hash.substring(1), start_time, end_time]
|
[this.hash.substring(1), start_time, end_time]
|
||||||
);
|
);
|
||||||
return r;
|
|
||||||
} else if (this.hash.startsWith('#%')) {
|
} else if (this.hash.startsWith('#%')) {
|
||||||
return await tfrpc.rpc.query(
|
result = await tfrpc.rpc.query(
|
||||||
`
|
`
|
||||||
SELECT id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
SELECT id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
|
||||||
FROM messages
|
FROM messages
|
||||||
@ -143,7 +145,7 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return [].concat(...(await Promise.all(promises)));
|
result = [].concat(...(await Promise.all(promises)));
|
||||||
} else {
|
} else {
|
||||||
let promises = [];
|
let promises = [];
|
||||||
const k_following_limit = 256;
|
const k_following_limit = 256;
|
||||||
@ -176,8 +178,10 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return [].concat(...(await Promise.all(promises)));
|
result = [].concat(...(await Promise.all(promises)));
|
||||||
}
|
}
|
||||||
|
this.time_loading = undefined;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_time_range_from_messages(messages) {
|
update_time_range_from_messages(messages) {
|
||||||
@ -306,6 +310,7 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
this.loading--;
|
this.loading--;
|
||||||
}
|
}
|
||||||
this.messages = messages;
|
this.messages = messages;
|
||||||
|
this.time_loading = undefined;
|
||||||
console.log(`loading messages done for ${self.whoami}`);
|
console.log(`loading messages done for ${self.whoami}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,8 +368,18 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<span
|
<span
|
||||||
>Showing ${new Date(this.time_range[0]).toLocaleDateString()} -
|
>Showing
|
||||||
${new Date(this.time_range[1]).toLocaleDateString()}.</span
|
${new Date(
|
||||||
|
this.time_loading
|
||||||
|
? Math.min(this.time_loading[0], this.time_range[0])
|
||||||
|
: this.time_range[0]
|
||||||
|
).toLocaleDateString()}
|
||||||
|
-
|
||||||
|
${new Date(
|
||||||
|
this.time_loading
|
||||||
|
? Math.max(this.time_loading[1], this.time_range[1])
|
||||||
|
: this.time_range[1]
|
||||||
|
).toLocaleDateString()}.</span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user