ssb: Preliminary view of flagged messages. Seems a bit counter-productive, but here we are.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 9m3s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 9m3s
This commit is contained in:
@@ -185,6 +185,7 @@ class TfElement extends LitElement {
|
||||
'',
|
||||
'@',
|
||||
'👍',
|
||||
'🚩',
|
||||
...Object.keys(this.visible_private())
|
||||
.sort()
|
||||
.map((x) => '🔐' + JSON.parse(x).join(',')),
|
||||
@@ -491,6 +492,13 @@ class TfElement extends LitElement {
|
||||
`,
|
||||
k_args
|
||||
),
|
||||
tfrpc.rpc.query(
|
||||
`
|
||||
SELECT '🚩' AS channel, MAX(messages.rowid) AS rowid FROM messages
|
||||
WHERE messages.content ->> 'type' = 'flag'
|
||||
`,
|
||||
k_args
|
||||
),
|
||||
])
|
||||
).flat();
|
||||
let latest = {'🔐': undefined};
|
||||
|
||||
@@ -245,6 +245,23 @@ class TfTabNewsFeedElement extends LitElement {
|
||||
`,
|
||||
[JSON.stringify(this.following), start_time, end_time, k_max_results]
|
||||
);
|
||||
} else if (this.hash == '#🚩') {
|
||||
result = await tfrpc.rpc.query(
|
||||
`
|
||||
WITH flags AS (SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
||||
FROM messages
|
||||
WHERE
|
||||
messages.content ->> 'type' = 'flag' AND
|
||||
(?1 IS NULL OR messages.timestamp >= ?1) AND messages.timestamp < ?2
|
||||
ORDER BY timestamp DESC limit ?3)
|
||||
SELECT FALSE 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 flags
|
||||
JOIN messages ON messages.id = flags.content ->> '$.flag.link'
|
||||
UNION
|
||||
SELECT TRUE AS is_primary, * FROM flags
|
||||
`,
|
||||
[start_time, end_time, k_max_results]
|
||||
);
|
||||
} else {
|
||||
let initial_messages = await tfrpc.rpc.query(
|
||||
`
|
||||
|
||||
@@ -243,6 +243,12 @@ class TfTabNewsElement extends LitElement {
|
||||
style=${this.hash == '#👍' ? 'font-weight: bold' : undefined}
|
||||
>${this.unread_status('👍')}👍votes</a
|
||||
>
|
||||
<a
|
||||
href="#🚩"
|
||||
class="w3-bar-item w3-button"
|
||||
style=${this.hash == '#🚩' ? 'font-weight: bold' : undefined}
|
||||
>${this.unread_status('🚩')}🚩flagged</a
|
||||
>
|
||||
${Object.keys(this?.visible_private_messages ?? [])
|
||||
?.sort()
|
||||
?.map(
|
||||
|
||||
Reference in New Issue
Block a user