fix: don't show self zaps on note summary

This commit is contained in:
Alejandro Gomez 2023-02-05 12:04:18 +01:00
parent ec28a51148
commit 62ae180652
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
2 changed files with 5 additions and 4 deletions

View File

@ -51,7 +51,10 @@ export default function NoteFooter(props: NoteFooterProps) {
const langNames = new Intl.DisplayNames([...window.navigator.languages], { type: "language" });
const reactions = useMemo(() => getReactions(related, ev.Id, EventKind.Reaction), [related, ev]);
const reposts = useMemo(() => getReactions(related, ev.Id, EventKind.Repost), [related, ev]);
const zaps = useMemo(() => getReactions(related, ev.Id, EventKind.ZapReceipt).map(parseZap).filter(z => z.valid), [related]);
const zaps = useMemo(() =>
getReactions(related, ev.Id, EventKind.ZapReceipt).map(parseZap).filter(z => z.valid && z.zapper !== ev.PubKey),
[related]
);
const zapTotal = zaps.reduce((acc, z) => acc + z.amount, 0)
const didZap = zaps.some(a => a.zapper === login);
const groupReactions = useMemo(() => {

View File

@ -123,6 +123,7 @@ export default function ProfilePage() {
case ProfileTab.Zaps: {
return (
<div className="main-content">
<h4>{formatShort(zapsTotal)} sats</h4>
{zaps.map(z => <ZapElement showZapped={false} zap={z} />)}
</div>
)
@ -182,9 +183,6 @@ export default function ProfilePage() {
<>
<IconButton onClick={() => setShowLnQr(true)}>
<Zap width={14} height={16} />
<span className="zap-amount">
{zapsTotal > 0 && formatShort(zapsTotal)}
</span>
</IconButton>
{!loggedOut && (
<>