|
|
|
@@ -258,12 +258,20 @@ class TfTabNewsFeedElement extends LitElement {
|
|
|
|
`
|
|
|
|
`
|
|
|
|
SELECT TRUE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
|
|
|
SELECT TRUE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
|
|
|
FROM messages
|
|
|
|
FROM messages
|
|
|
|
JOIN json_each(?) AS following ON messages.author = following.value
|
|
|
|
JOIN json_each(?1) AS following ON messages.author = following.value
|
|
|
|
|
|
|
|
LEFT OUTER JOIN json_each(?5) AS channels ON messages.content ->> 'channel' = channels.value
|
|
|
|
WHERE messages.timestamp < ?3 AND (?2 IS NULL OR messages.timestamp >= ?2) AND
|
|
|
|
WHERE messages.timestamp < ?3 AND (?2 IS NULL OR messages.timestamp >= ?2) AND
|
|
|
|
messages.content ->> 'type' != 'vote'
|
|
|
|
messages.content ->> 'type' != 'vote' AND channels.value IS NULL AND
|
|
|
|
|
|
|
|
NOT EXISTS (SELECT * FROM messages_refs JOIN json_each(?5) AS channels ON messages_refs.ref = '#' || channels.value WHERE messages_refs.message = messages.id)
|
|
|
|
ORDER BY timestamp DESC LIMIT ?4
|
|
|
|
ORDER BY timestamp DESC LIMIT ?4
|
|
|
|
`,
|
|
|
|
`,
|
|
|
|
[JSON.stringify(this.following), start_time, end_time, k_max_results]
|
|
|
|
[
|
|
|
|
|
|
|
|
JSON.stringify(this.following),
|
|
|
|
|
|
|
|
start_time,
|
|
|
|
|
|
|
|
end_time,
|
|
|
|
|
|
|
|
k_max_results,
|
|
|
|
|
|
|
|
JSON.stringify(Object.keys(this.channels_latest)),
|
|
|
|
|
|
|
|
]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
let t1 = new Date();
|
|
|
|
let t1 = new Date();
|
|
|
|
result = await this._fetch_related_messages(initial_messages);
|
|
|
|
result = await this._fetch_related_messages(initial_messages);
|
|
|
|
@@ -396,6 +404,9 @@ class TfTabNewsFeedElement extends LitElement {
|
|
|
|
this._private_messages =
|
|
|
|
this._private_messages =
|
|
|
|
JSON.stringify(this.private_messages) +
|
|
|
|
JSON.stringify(this.private_messages) +
|
|
|
|
JSON.stringify(this.grouped_private_messages);
|
|
|
|
JSON.stringify(this.grouped_private_messages);
|
|
|
|
|
|
|
|
this._channels_latest = JSON.stringify(
|
|
|
|
|
|
|
|
Object.keys(this.channels_latest ?? {})
|
|
|
|
|
|
|
|
);
|
|
|
|
let now = new Date().valueOf();
|
|
|
|
let now = new Date().valueOf();
|
|
|
|
let start_time = now - 24 * 60 * 60 * 1000;
|
|
|
|
let start_time = now - 24 * 60 * 60 * 1000;
|
|
|
|
this.start_time = start_time;
|
|
|
|
this.start_time = start_time;
|
|
|
|
@@ -471,7 +482,9 @@ class TfTabNewsFeedElement extends LitElement {
|
|
|
|
this._messages_following !== JSON.stringify(this.following) ||
|
|
|
|
this._messages_following !== JSON.stringify(this.following) ||
|
|
|
|
this._private_messages !==
|
|
|
|
this._private_messages !==
|
|
|
|
JSON.stringify(this.private_messages) +
|
|
|
|
JSON.stringify(this.private_messages) +
|
|
|
|
JSON.stringify(this.grouped_private_messages)
|
|
|
|
JSON.stringify(this.grouped_private_messages) ||
|
|
|
|
|
|
|
|
this._channels_latest !==
|
|
|
|
|
|
|
|
JSON.stringify(Object.keys(this.channels_latest))
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
console.log(
|
|
|
|
console.log(
|
|
|
|
`loading messages for ${this.whoami} (following ${this.following.length})`
|
|
|
|
`loading messages for ${this.whoami} (following ${this.following.length})`
|
|
|
|
|