{pinnedEventIds?.map((id) =>
)}
- {filteredNotes.map(({ key, event, reposters }) => (
+ {slicedNotes.map(({ key, event, reposters }) => (
}
- if (notification.kind === kinds.Repost) {
+ if (notification.kind === kinds.Repost || notification.kind === kinds.GenericRepost) {
return
}
if (notification.kind === kinds.Zap) {
diff --git a/src/components/NotificationList/index.tsx b/src/components/NotificationList/index.tsx
index 9ddcaccc..f09f94e2 100644
--- a/src/components/NotificationList/index.tsx
+++ b/src/components/NotificationList/index.tsx
@@ -58,13 +58,14 @@ const NotificationList = forwardRef((_, ref) => {
ExtendedKind.POLL
]
case 'reactions':
- return [kinds.Reaction, kinds.Repost, ExtendedKind.POLL_RESPONSE]
+ return [kinds.Reaction, kinds.Repost, kinds.GenericRepost, ExtendedKind.POLL_RESPONSE]
case 'zaps':
return [kinds.Zap]
default:
return [
kinds.ShortTextNote,
kinds.Repost,
+ kinds.GenericRepost,
kinds.Reaction,
kinds.Zap,
ExtendedKind.COMMENT,
diff --git a/src/components/RepostList/index.tsx b/src/components/RepostList/index.tsx
index 232c4807..e1c51704 100644
--- a/src/components/RepostList/index.tsx
+++ b/src/components/RepostList/index.tsx
@@ -1,5 +1,6 @@
import { useSecondaryPage } from '@/PageManager'
import { useStuffStatsById } from '@/hooks/useStuffStatsById'
+import { getEventKey } from '@/lib/event'
import { toProfile } from '@/lib/link'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
@@ -19,7 +20,7 @@ export default function RepostList({ event }: { event: Event }) {
const { push } = useSecondaryPage()
const { isSmallScreen } = useScreenSize()
const { hideUntrustedInteractions, isUserTrusted } = useUserTrust()
- const noteStats = useStuffStatsById(event.id)
+ const noteStats = useStuffStatsById(getEventKey(event))
const filteredReposts = useMemo(() => {
return (noteStats?.reposts ?? [])
.filter((repost) => !hideUntrustedInteractions || isUserTrusted(repost.pubkey))
diff --git a/src/constants.ts b/src/constants.ts
index 69168177..6067094a 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -88,6 +88,7 @@ export const ExtendedKind = {
export const SUPPORTED_KINDS = [
kinds.ShortTextNote,
kinds.Repost,
+ kinds.GenericRepost,
ExtendedKind.PICTURE,
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
diff --git a/src/lib/draft-event.ts b/src/lib/draft-event.ts
index 6195ca77..022d5d84 100644
--- a/src/lib/draft-event.ts
+++ b/src/lib/draft-event.ts
@@ -118,12 +118,22 @@ export function createRepostDraftEvent(event: Event): TDraftEvent {
const isProtected = isProtectedEvent(event)
const tags = [buildETag(event.id, event.pubkey), buildPTag(event.pubkey)]
+ if (event.kind === kinds.ShortTextNote) {
+ return {
+ kind: kinds.Repost,
+ content: isProtected ? '' : JSON.stringify(event),
+ tags,
+ created_at: dayjs().unix()
+ }
+ }
+
+ tags.push(buildKTag(event.kind))
if (isReplaceableEvent(event.kind)) {
tags.push(buildATag(event))
}
return {
- kind: kinds.Repost,
+ kind: kinds.GenericRepost,
content: isProtected ? '' : JSON.stringify(event),
tags,
created_at: dayjs().unix()
diff --git a/src/services/local-storage.service.ts b/src/services/local-storage.service.ts
index 4d5967bc..0ba65151 100644
--- a/src/services/local-storage.service.ts
+++ b/src/services/local-storage.service.ts
@@ -23,6 +23,7 @@ import {
TThemeSetting,
TTranslationServiceConfig
} from '@/types'
+import { kinds } from 'nostr-tools'
class LocalStorageService {
static instance: LocalStorageService
@@ -181,10 +182,13 @@ class LocalStorageService {
showKindSet.delete(24236) // remove typo kind
showKindSet.add(ExtendedKind.ADDRESSABLE_SHORT_VIDEO)
}
+ if (showKindsVersion < 4 && showKindSet.has(kinds.Repost)) {
+ showKindSet.add(kinds.GenericRepost)
+ }
this.showKinds = Array.from(showKindSet)
}
window.localStorage.setItem(StorageKey.SHOW_KINDS, JSON.stringify(this.showKinds))
- window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '3')
+ window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '4')
this.hideContentMentioningMutedUsers =
window.localStorage.getItem(StorageKey.HIDE_CONTENT_MENTIONING_MUTED_USERS) === 'true'
diff --git a/src/services/stuff-stats.service.ts b/src/services/stuff-stats.service.ts
index 9a057e26..b36c8fbc 100644
--- a/src/services/stuff-stats.service.ts
+++ b/src/services/stuff-stats.service.ts
@@ -107,7 +107,10 @@ class StuffStatsService {
? {
'#e': [event.id],
authors: [pubkey],
- kinds: [kinds.Reaction, kinds.Repost]
+ kinds:
+ event.kind === kinds.ShortTextNote
+ ? [kinds.Reaction, kinds.Repost]
+ : [kinds.Reaction, kinds.Repost, kinds.GenericRepost]
}
: {
'#i': [externalContent],
@@ -120,7 +123,7 @@ class StuffStatsService {
filters.push({
'#a': [replaceableCoordinate],
authors: [pubkey],
- kinds: [kinds.Reaction, kinds.Repost]
+ kinds: [kinds.Reaction, kinds.Repost, kinds.GenericRepost]
})
}
@@ -218,7 +221,7 @@ class StuffStatsService {
targetKey = this.addLikeByEvent(evt)
} else if (evt.kind === ExtendedKind.EXTERNAL_CONTENT_REACTION) {
targetKey = this.addExternalContentLikeByEvent(evt)
- } else if (evt.kind === kinds.Repost) {
+ } else if (evt.kind === kinds.Repost || evt.kind === kinds.GenericRepost) {
targetKey = this.addRepostByEvent(evt)
} else if (evt.kind === kinds.Zap) {
targetKey = this.addZapByEvent(evt)
@@ -291,18 +294,25 @@ class StuffStatsService {
}
private addRepostByEvent(evt: Event) {
- const eventId = evt.tags.find(tagNameEquals('e'))?.[1]
- if (!eventId) return
+ let targetEventKey
+ targetEventKey = evt.tags.find(tagNameEquals('a'))?.[1]
+ if (!targetEventKey) {
+ targetEventKey = evt.tags.find(tagNameEquals('e'))?.[1]
+ }
- const old = this.stuffStatsMap.get(eventId) || {}
+ if (!targetEventKey) {
+ return
+ }
+
+ const old = this.stuffStatsMap.get(targetEventKey) || {}
const repostPubkeySet = old.repostPubkeySet || new Set()
const reposts = old.reposts || []
if (repostPubkeySet.has(evt.pubkey)) return
repostPubkeySet.add(evt.pubkey)
reposts.push({ id: evt.id, pubkey: evt.pubkey, created_at: evt.created_at })
- this.stuffStatsMap.set(eventId, { ...old, repostPubkeySet, reposts })
- return eventId
+ this.stuffStatsMap.set(targetEventKey, { ...old, repostPubkeySet, reposts })
+ return targetEventKey
}
private addZapByEvent(evt: Event) {