Remove broken "new account" badge

The badge marked notes from pubkeys whose kind-0 profile event was
newer than 60 days, on the theory that that approximated account age.
It doesn't: kind-0 created_at is "profile last updated," so any user
who refreshed their bio recently got flagged as new regardless of how
long they've been on Nostr. The proxy was misleading, so drop it
entirely until there's a real signal to use.

- NoteCard.tsx: remove isNewAccount badge.
- social.ts: remove batchFetchProfileAges, getProfileAge, and the
  module-level profileAgeCache Map.
- nostr/index.ts: drop the barrel re-exports.
This commit is contained in:
Jure
2026-04-23 19:20:37 +02:00
parent 6a23f0223c
commit 7a07d732e6
3 changed files with 2 additions and 25 deletions

View File

@@ -7,7 +7,7 @@ import { useUserStore } from "../../stores/user";
import { useMuteStore } from "../../stores/mute";
import { useUIStore } from "../../stores/ui";
import { timeAgo, shortenPubkey } from "../../lib/utils";
import { getNDK, fetchNoteById, ensureConnected, getProfileAge } from "../../lib/nostr";
import { getNDK, fetchNoteById, ensureConnected } from "../../lib/nostr";
import { getParentEventId } from "../../lib/threadTree";
import { NoteContent } from "./NoteContent";
import { NoteActions, LoggedOutStats } from "./NoteActions";
@@ -38,8 +38,6 @@ export const NoteCard = memo(function NoteCard({ event, focused, onReplyInThread
const nip05 = typeof profile?.nip05 === "string" ? profile.nip05 : null;
const verified = useNip05Verified(event.pubkey, nip05, inView);
const time = event.created_at ? timeAgo(event.created_at) : "";
const profileCreatedAt = getProfileAge(event.pubkey);
const isNewAccount = profileCreatedAt !== null && (Date.now() / 1000 - profileCreatedAt) < 60 * 24 * 3600;
const loggedIn = useUserStore((s) => s.loggedIn);
const ownPubkey = useUserStore((s) => s.pubkey);
@@ -115,9 +113,6 @@ export const NoteCard = memo(function NoteCard({ event, focused, onReplyInThread
</span>
)}
<span className="text-text-dim text-[11px] shrink-0">{time}</span>
{isNewAccount && (
<span title="Account created less than 60 days ago" className="text-[9px] px-1 py-0.5 border border-warning/40 text-warning/70 shrink-0 leading-none">new</span>
)}
{/* Context menu — hidden until card hover, not shown for own notes */}
{loggedIn && event.pubkey !== ownPubkey && (
<div className="relative ml-auto">

View File

@@ -1,6 +1,6 @@
export { getNDK, getNDKUptimeMs, connectToRelays, ensureConnected, resetNDK, getStoredRelayUrls, normalizeRelayUrl, addRelay, removeRelay, fetchWithTimeout, withTimeout, FEED_TIMEOUT, THREAD_TIMEOUT, SINGLE_TIMEOUT } from "./core";
export { fetchGlobalFeed, fetchMediaFeed, fetchFollowFeed, fetchUserNotes, fetchUserNotesNIP65, fetchNoteById, fetchReplies, publishNote, publishReply, publishRepost, publishQuote, fetchHashtagFeed, fetchThreadEvents, fetchAncestors } from "./notes";
export { publishProfile, publishContactList, fetchProfile, fetchFollowSuggestions, fetchMentions, fetchFollowers, fetchNewFollowers, batchFetchProfileAges, getProfileAge } from "./social";
export { publishProfile, publishContactList, fetchProfile, fetchFollowSuggestions, fetchMentions, fetchFollowers, fetchNewFollowers } from "./social";
export { publishArticle, fetchArticle, fetchAuthorArticles, fetchArticleFeed, searchArticles, fetchByAddr } from "./articles";
export { publishReaction, fetchReplyCount, fetchZapCount, fetchReactions, groupReactions, fetchBatchEngagement, fetchZapsReceived, fetchZapsSent } from "./engagement";
export type { GroupedReactions, BatchEngagement } from "./engagement";

View File

@@ -38,24 +38,6 @@ export async function fetchProfile(pubkey: string) {
return user.profile ?? null;
}
// Bulk-fetch kind-0 events for many pubkeys in one relay query and populate
// the profile-age cache. Called once per feed/thread load — not per note.
const profileAgeCache = new Map<string, number>();
export function getProfileAge(pubkey: string): number | null {
return profileAgeCache.get(pubkey) ?? null;
}
export async function batchFetchProfileAges(pubkeys: string[]): Promise<void> {
const needed = pubkeys.filter((pk) => !profileAgeCache.has(pk));
if (needed.length === 0) return;
const instance = getNDK();
const events = await fetchWithTimeout(instance, { kinds: [0], authors: needed }, FEED_TIMEOUT);
for (const event of events) {
if (event.created_at) profileAgeCache.set(event.pubkey, event.created_at);
}
}
export async function fetchFollowSuggestions(myFollows: string[]): Promise<{ pubkey: string; mutualCount: number }[]> {
if (myFollows.length === 0) return [];
const instance = getNDK();