MetadataCache -> CachedMetadata, addCachedMetadataToFuzzySearch

This commit is contained in:
Martti Malmi
2024-01-08 16:12:05 +02:00
parent 88924941a5
commit c80eb25d29
20 changed files with 92 additions and 71 deletions

View File

@ -1,4 +1,4 @@
import { MetadataCache } from "@snort/system";
import { CachedMetadata } from "@snort/system";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";
@ -10,7 +10,7 @@ export class BackupKeyTask extends BaseUITask {
id = "backup-key";
noBaseStyle = true;
check(_: MetadataCache, session: LoginSession): boolean {
check(_: CachedMetadata, session: LoginSession): boolean {
return !this.state.muted && session.type == "private_key";
}

View File

@ -1,4 +1,4 @@
import { MetadataCache } from "@snort/system";
import { CachedMetadata } from "@snort/system";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";
@ -7,7 +7,7 @@ import { BaseUITask } from "@/Components/Tasks/index";
export class Nip5Task extends BaseUITask {
id = "buy-nip5";
check(user: MetadataCache): boolean {
check(user: CachedMetadata): boolean {
return !this.state.muted && !user.nip05;
}

View File

@ -1,4 +1,4 @@
import { MetadataCache } from "@snort/system";
import { CachedMetadata } from "@snort/system";
import { FormattedMessage } from "react-intl";
import { BaseUITask } from "@/Components/Tasks/index";
@ -9,7 +9,7 @@ import { getCurrentSubscription } from "@/Utils/Subscription";
export class RenewSubTask extends BaseUITask {
id = "renew-sub";
check(user: MetadataCache, session: LoginSession): boolean {
check(user: CachedMetadata, session: LoginSession): boolean {
const sub = getCurrentSubscription(session.subscriptions);
return !sub && session.subscriptions.length > 0;
}

View File

@ -1,4 +1,4 @@
import { MetadataCache } from "@snort/system";
import { CachedMetadata } from "@snort/system";
import { LoginSession } from "@/Utils/Login";
@ -8,7 +8,7 @@ export interface UITask {
/**
* Run checks to determine if this Task should be triggered for this user
*/
check(user: MetadataCache, session: LoginSession): boolean;
check(user: CachedMetadata, session: LoginSession): boolean;
mute(): void;
load(cb: () => void): void;
render(): JSX.Element;
@ -26,7 +26,7 @@ export abstract class BaseUITask implements UITask {
abstract id: string;
noBaseStyle = false;
abstract check(user: MetadataCache, session: LoginSession): boolean;
abstract check(user: CachedMetadata, session: LoginSession): boolean;
abstract render(): JSX.Element;
constructor() {