Don't include deleted or empty articles in list

This commit is contained in:
2024-10-28 13:56:36 +01:00
parent 5906655902
commit cea96e170d
4 changed files with 36 additions and 8 deletions

View File

@@ -61,9 +61,12 @@ export async function fetchArticlesByAuthor(
}]) as NostrEvent[];
const articles = events.map((a) => new Article(a));
const sortedArticles = articles.sort((a, b) => b.publishedAt - a.publishedAt);
// The limit seems to apply per relay, not per pool query
return sortedArticles.slice(0, limit);
return articles
.filter((a) => !a.isDeleted)
.filter((a) => a.content.trim() !== "")
.sort((a, b) => b.publishedAt - a.publishedAt)
.slice(0, limit); // The limit seems to apply per relay, not per pool query
}
export async function fetchProfileEvent(pubkey: string) {