Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -16,6 +16,7 @@ import { useDarkMode } from "~/hooks/useDarkMode"
|
||||
import { useMobileLayout } from "~/hooks/useMobileLayout"
|
||||
import { useNProgress } from "~/hooks/useNProgress"
|
||||
import { APP_NAME } from "~/lib/env"
|
||||
import { filterNotificationCharacter } from "~/lib/filter-character"
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
import { urlComposer } from "~/lib/url-composer"
|
||||
@@ -80,7 +81,10 @@ export default function Providers({
|
||||
ignoreWalletDisconnectEvent={true}
|
||||
>
|
||||
<LangProvider lang={lang}>{children}</LangProvider>
|
||||
<NotificationModal colorScheme={colorScheme} />
|
||||
<NotificationModal
|
||||
colorScheme={colorScheme}
|
||||
filter={filterNotificationCharacter}
|
||||
/>
|
||||
</ConnectKitProvider>
|
||||
</PersistQueryClientProvider>
|
||||
</WagmiConfig>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { CharacterEntity } from "crossbell"
|
||||
|
||||
import { ParsedNotification } from "@crossbell/indexer"
|
||||
|
||||
import filter from "../../data/filter.json"
|
||||
|
||||
type CharacterId = CharacterEntity["characterId"]
|
||||
|
||||
export function filterCharacter<T>(
|
||||
blacklist: CharacterId[],
|
||||
getCharacterId: (item: T) => CharacterId | null | undefined,
|
||||
) {
|
||||
const cache = new Map(blacklist.map((characterId) => [characterId, true]))
|
||||
|
||||
return function filter(item: T): boolean {
|
||||
const characterId = getCharacterId(item)
|
||||
|
||||
return characterId ? !cache.has(characterId) : false
|
||||
}
|
||||
}
|
||||
|
||||
export const filterNotificationCharacter = filterCharacter(
|
||||
filter.latest,
|
||||
({ fromCharacter }: ParsedNotification) => fromCharacter?.characterId,
|
||||
)
|
||||
|
||||
export const filterCommentCharacter = filterCharacter(
|
||||
filter.comment,
|
||||
({ characterId }: Pick<CharacterEntity, "characterId">) => characterId,
|
||||
)
|
||||
@@ -12,13 +12,12 @@ import { GeneralAccount } from "@crossbell/connect-kit"
|
||||
import { indexer } from "@crossbell/indexer"
|
||||
|
||||
import { expandCrossbellNote } from "~/lib/expand-unit"
|
||||
import { filterCommentCharacter } from "~/lib/filter-character"
|
||||
import { checkSlugReservedWords } from "~/lib/slug-reserved-words"
|
||||
import { getKeys, getStorage } from "~/lib/storage"
|
||||
import { ExpandedNote, PageVisibilityEnum } from "~/lib/types"
|
||||
import { client } from "~/queries/graphql"
|
||||
|
||||
import filter from "../../data/filter.json"
|
||||
|
||||
export async function checkPageSlug(input: {
|
||||
slug: string
|
||||
characterId?: number
|
||||
@@ -611,9 +610,7 @@ export async function getComments({
|
||||
list: [],
|
||||
}
|
||||
|
||||
res.list = res.list.filter(
|
||||
(item) => !filter.comment.includes(item.characterId),
|
||||
)
|
||||
res.list = res.list.filter(filterCommentCharacter)
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user