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 { useSelector } from "react-redux";
import { System } from "Nostr/System"; import { System } from "Nostr/System";
import { default as NEvent } from "Nostr/Event"; import { default as NEvent } from "Nostr/Event";
import EventKind from "Nostr/EventKind"; import EventKind from "Nostr/EventKind";
import Tag from "Nostr/Tag"; import Tag from "Nostr/Tag";
import { RootState } from "State/Store"; import { RootState } from "State/Store";
import { HexKey, RawEvent, u256, UserMetadata } from "Nostr"; import { HexKey, RawEvent, u256, UserMetadata } from "Nostr";
import { MUTE_LIST_TAG } from "Feed/MuteList";
import { bech32ToHex } from "Util" import { bech32ToHex } from "Util"
import { DefaultRelays, HashtagRegex } from "Const"; import { DefaultRelays, HashtagRegex } from "Const";
@ -99,7 +101,7 @@ export default function useEventPublisher() {
if (pubKey) { if (pubKey) {
let ev = NEvent.ForPubKey(pubKey); let ev = NEvent.ForPubKey(pubKey);
ev.Kind = EventKind.Lists; 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 => { keys.forEach(p => {
ev.Tags.push(new Tag(["p", p], ev.Tags.length)) 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.Id = "login:muted";
sub.Kinds = new Set([EventKind.Lists]); sub.Kinds = new Set([EventKind.Lists]);
sub.Authors = new Set([pubKey]); 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; sub.Limit = 1;
return sub; return sub;

View File

@ -18,8 +18,7 @@ export default function useMutedFeed(pubkey: HexKey) {
sub.Id = `muted:${pubkey}`; sub.Id = `muted:${pubkey}`;
sub.Kinds = new Set([EventKind.Lists]); sub.Kinds = new Set([EventKind.Lists]);
sub.Authors = new Set([pubkey]); 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; sub.Limit = 1;
return sub; return sub;

View File

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

View File

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