Filter by hashtags and urls again

This commit is contained in:
Max Nuding 2023-04-01 16:24:35 +02:00
parent d2f2214d65
commit c939b611a9
Signed by: phlaym
GPG Key ID: A06651BAB6777237
2 changed files with 6 additions and 1 deletions

View File

@ -199,6 +199,11 @@ export async function getPosts(since: string | null, limit: number) {
reject(err); reject(err);
return; return;
} }
if (rows.length === 0) {
// No need to check for tags
resolve([]);
return;
}
const postIdsParams = rows.map(() => '?').join(', '); const postIdsParams = rows.map(() => '?').join(', ');
db.all( db.all(
`SELECT post_id, tags.url, tags.tag `SELECT post_id, tags.url, tags.tag

View File

@ -30,7 +30,7 @@ export class TimelineReader {
const found_urls = urls.filter(t => post.content.includes(t)); const found_urls = urls.filter(t => post.content.includes(t));
if (found_urls.length === 0 && found_tags.length === 0) { if (found_urls.length === 0 && found_tags.length === 0) {
//return; return;
} }
const youtubeMatches = found_urls.map(u => u.match(YOUTUBE_REGEX)).filter(i => i !== null); const youtubeMatches = found_urls.map(u => u.match(YOUTUBE_REGEX)).filter(i => i !== null);