do not render reposts of badge award events in timelines (#406)

* do not render reposts of badge award events

* fix var name

* only render reposts of kind 1 events
This commit is contained in:
Sam Samskies 2023-03-08 07:30:19 -10:00 committed by GitHub
parent bc72bf6d04
commit c4d8d871a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -56,12 +56,13 @@ export default function NoteReaction(props: NoteReactionProps) {
const root = extractRoot(); const root = extractRoot();
const isOpMuted = root && isMuted(root.pubkey); const isOpMuted = root && isMuted(root.pubkey);
const shouldNotBeRendered = isOpMuted || root?.kind !== EventKind.TextNote;
const opt = { const opt = {
showHeader: ev?.Kind === EventKind.Repost || ev?.Kind === EventKind.TextNote, showHeader: ev?.Kind === EventKind.Repost || ev?.Kind === EventKind.TextNote,
showFooter: false, showFooter: false,
}; };
return isOpMuted ? null : ( return shouldNotBeRendered ? null : (
<div className="reaction"> <div className="reaction">
<div className="header flex"> <div className="header flex">
<ProfileImage pubkey={ev.RootPubKey} /> <ProfileImage pubkey={ev.RootPubKey} />
@ -69,7 +70,6 @@ export default function NoteReaction(props: NoteReactionProps) {
<NoteTime from={ev.CreatedAt * 1000} /> <NoteTime from={ev.CreatedAt * 1000} />
</div> </div>
</div> </div>
{root ? <Note data={root} options={opt} related={[]} /> : null} {root ? <Note data={root} options={opt} related={[]} /> : null}
{!root && refEvent ? ( {!root && refEvent ? (
<p> <p>

View File

@ -8,6 +8,7 @@ enum EventKind {
Deletion = 5, // NIP-09 Deletion = 5, // NIP-09
Repost = 6, // NIP-18 Repost = 6, // NIP-18
Reaction = 7, // NIP-25 Reaction = 7, // NIP-25
BadgeAward = 8, // NIP-58
Relays = 10002, // NIP-65 Relays = 10002, // NIP-65
Ephemeral = 20_000, Ephemeral = 20_000,
Auth = 22242, // NIP-42 Auth = 22242, // NIP-42