trends: notes -> #e, normalize

This commit is contained in:
Alex Gleason 2024-06-02 18:28:43 -05:00
parent 76c882d836
commit fc11e34499
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ async function getTrendingHashtags() {
return label.created_at >= since && label.created_at < until; return label.created_at >= since && label.created_at < until;
}); });
const [, , accounts, uses] = label?.tags.find(([name, value]) => name === 't' && value === hashtag) ?? []; const [, , , accounts, uses] = label?.tags.find(([name, value]) => name === 't' && value === hashtag) ?? [];
return { return {
day: String(date.getTime() / 1000), day: String(date.getTime() / 1000),
@ -97,7 +97,7 @@ const trendingStatusesController: AppController = async (c) => {
const [label] = await store.query([{ const [label] = await store.query([{
kinds: [1985], kinds: [1985],
'#L': ['pub.ditto.trends'], '#L': ['pub.ditto.trends'],
'#l': ['notes'], '#l': ['#e'],
authors: [Conf.pubkey], authors: [Conf.pubkey],
limit: 1, limit: 1,
}]); }]);

View File

@ -32,7 +32,7 @@ async function updateTrendingNotes() {
content: '', content: '',
tags: [ tags: [
['L', 'pub.ditto.trends'], ['L', 'pub.ditto.trends'],
['l', 'notes', 'pub.ditto.trends'], ['l', '#e', 'pub.ditto.trends'],
...events.map(({ id }) => ['e', id, Conf.relay]), ...events.map(({ id }) => ['e', id, Conf.relay]),
], ],
created_at: Math.floor(Date.now() / 1000), created_at: Math.floor(Date.now() / 1000),
@ -64,7 +64,7 @@ async function updateTrendingHashtags() {
tags: [ tags: [
['L', 'pub.ditto.trends'], ['L', 'pub.ditto.trends'],
['l', '#t', 'pub.ditto.trends'], ['l', '#t', 'pub.ditto.trends'],
...hashtags.map(({ value, authors, uses }) => ['t', value, authors.toString(), uses.toString()]), ...hashtags.map(({ value, authors, uses }) => ['t', '', value, authors.toString(), uses.toString()]),
], ],
created_at: Math.floor(Date.now() / 1000), created_at: Math.floor(Date.now() / 1000),
}); });
@ -95,7 +95,7 @@ async function updateTrendingLinks() {
tags: [ tags: [
['L', 'pub.ditto.trends'], ['L', 'pub.ditto.trends'],
['l', '#r', 'pub.ditto.trends'], ['l', '#r', 'pub.ditto.trends'],
...links.map(({ value, authors, uses }) => ['r', value, authors.toString(), uses.toString()]), ...links.map(({ value, authors, uses }) => ['r', '', value, authors.toString(), uses.toString()]),
], ],
created_at: Math.floor(Date.now() / 1000), created_at: Math.floor(Date.now() / 1000),
}); });