fix: correctly filter with tag

This commit is contained in:
Alejandro Gomez 2023-01-27 11:47:05 +01:00
parent ba2fde425f
commit 613665c187
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
5 changed files with 17 additions and 5 deletions

View File

@ -1,10 +1,12 @@
import { useSelector } from "react-redux";
import { System } from "Nostr/System";
import { default as NEvent } from "Nostr/Event";
import EventKind from "Nostr/EventKind";
import Tag from "Nostr/Tag";
import { RootState } from "State/Store";
import { HexKey, RawEvent, u256, UserMetadata } from "Nostr";
import { MUTE_LIST_TAG } from "Feed/MuteList";
import { bech32ToHex } from "Util"
import { DefaultRelays, HashtagRegex } from "Const";
@ -99,7 +101,7 @@ export default function useEventPublisher() {
if (pubKey) {
let ev = NEvent.ForPubKey(pubKey);
ev.Kind = EventKind.Lists;
ev.Tags.push(new Tag(["d", "mute"], ev.Tags.length))
ev.Tags.push(new Tag(["d", MUTE_LIST_TAG], ev.Tags.length))
keys.forEach(p => {
ev.Tags.push(new Tag(["p", p], ev.Tags.length))
})

View File

@ -52,8 +52,7 @@ export default function useLoginFeed() {
sub.Id = "login:muted";
sub.Kinds = new Set([EventKind.Lists]);
sub.Authors = new Set([pubKey]);
// TODO: not sure relay support this atm, don't seem to return results
// sub.DTags = new Set([MUTE_LIST_TAG])
sub.DTags = new Set([MUTE_LIST_TAG])
sub.Limit = 1;
return sub;

View File

@ -18,8 +18,7 @@ export default function useMutedFeed(pubkey: HexKey) {
sub.Id = `muted:${pubkey}`;
sub.Kinds = new Set([EventKind.Lists]);
sub.Authors = new Set([pubkey]);
// TODO: not sure relay support this atm, don't seem to return results
//sub.DTags = new Set([MUTE_LIST_TAG])
sub.DTags = new Set([MUTE_LIST_TAG])
sub.Limit = 1;
return sub;

View File

@ -8,6 +8,7 @@ export default class Tag {
Relay?: string;
Marker?: string;
Hashtag?: string;
DTag?: string;
Index: number;
Invalid: boolean;
@ -36,6 +37,10 @@ export default class Tag {
}
break;
}
case "d": {
this.DTag = tag[1];
break;
}
case "t": {
this.Hashtag = tag[1];
break;
@ -61,6 +66,9 @@ export default class Tag {
case "t": {
return ["t", this.Hashtag!];
}
case "d": {
return ["t", this.DTag!];
}
default: {
return this.Original;
}

View File

@ -124,6 +124,10 @@ button:disabled {
cursor: not-allowed;
color: var(--gray);
}
.light button:disabled {
color: var(--font-secondary-color);
border-color: var(--font-secondary-color);
}
button:hover {
background-color: var(--font-color);