fix: topics

This commit is contained in:
2023-11-22 16:16:07 +00:00
parent 5d9ca5ee39
commit 20c4ecaa0c

View File

@ -5,7 +5,7 @@ import AsyncButton from "@/Element/AsyncButton";
import classNames from "classnames"; import classNames from "classnames";
import { appendDedupe } from "@/SnortUtils"; import { appendDedupe } from "@/SnortUtils";
import useEventPublisher from "@/Hooks/useEventPublisher"; import useEventPublisher from "@/Hooks/useEventPublisher";
import { NostrHashtagLink } from "@snort/system"; import { EventKind } from "@snort/system";
export const FixedTopics = { export const FixedTopics = {
life: { life: {
@ -283,11 +283,14 @@ export function Topics() {
const tags = Object.entries(FixedTopics) const tags = Object.entries(FixedTopics)
.filter(([k]) => topics.includes(k)) .filter(([k]) => topics.includes(k))
.map(([, v]) => v.tags) .map(([, v]) => v.tags)
.flat() .flat();
.map(a => new NostrHashtagLink(a));
if (tags.length > 0) { if (tags.length > 0) {
const ev = await publisher?.bookmarks(tags, "follow"); const ev = await publisher?.generic(eb => {
eb.kind(EventKind.InterestsList);
tags.forEach(a => eb.tag(["t", a]));
return eb;
});
if (ev) { if (ev) {
await system.BroadcastEvent(ev); await system.BroadcastEvent(ev);
} }