mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Fix watch history hydration for address pointers with colons
Updated `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js` to properly handle and hydrate watch history items that use address pointers (type 'a'), specifically fixing a bug where d-tags containing colons were being ignored. Previously, only event ID pointers (type 'e') were being hydrated, and an initial fix for addresses failed for d-tags with colons. This change robustly parses address pointers, constructs appropriate filters, fetches the events, and correctly maps them back to the history items using a `normalizeAddressKey` utility that handles mixed-case pubkeys and complex d-tags.
This commit is contained in:
1 parent
1f54745840
commit
914e0abc58
1 file changed
+3
-6
@@ -284,14 +284,11 @@ function createWatchHistoryHydrationStage() {
|
||||
const addressFilters = new Map();
|
||||
for (const address of uniqueAddresses) {
|
||||
const parts = address.split(":");
|
||||
if (parts.length !== 3) continue;
|
||||
if (parts.length < 3) continue;
|
||||
const kind = Number(parts[0]);
|
||||
const pubkey = parts[1]; // Keep original case for filter? No, fetch should be robust.
|
||||
// Actually, Nostr pubkeys are lowercase hex.
|
||||
// If the pointer has Uppercase pubkey, we should lowercase it for the filter
|
||||
// because the relay will likely index it as lowercase or hex.
|
||||
const pubkey = parts[1];
|
||||
const normalizedPubkey = pubkey.toLowerCase();
|
||||
const dTag = parts[2];
|
||||
const dTag = parts.slice(2).join(":");
|
||||
|
||||
const key = `${kind}:${normalizedPubkey}`;
|
||||
if (!addressFilters.has(key)) {
|
||||
|
||||
Reference in new issue
Block a user