Get replies to work

This commit is contained in:
Eric Eastwood 2022-02-01 22:32:59 -06:00
parent 070ef6806d
commit 29c5c7e1f3
2 changed files with 34 additions and 1 deletions

View File

@ -77,6 +77,6 @@ async function main() {
}
//main();
main();
import './main2';

View File

@ -97,6 +97,39 @@ async function asdf() {
return makeEventEntryFromEventJson(eventJson);
});
console.log('eventEntries', eventEntries)
// mimic _addLocalRelationsToNewRemoteEntries from Timeline.js
for (const eventEntry of eventEntries) {
// this will work because we set relatedEventId when removing remote echos
if (eventEntry.relatedEventId) {
console.log('related', eventEntry.relatedEventId, eventEntry)
const relationTarget = eventEntries.find(e => e.id === eventEntry.relatedEventId);
console.log('relationTarget', relationTarget)
// no need to emit here as this entry is about to be added
relationTarget?.addLocalRelation(eventEntry);
}
if (eventEntry.redactingEntry) {
const eventId = eventEntry.redactingEntry.relatedEventId;
const relationTarget = eventEntries.find(e => e.id === eventId);
relationTarget?.addLocalRelation(eventEntry);
}
}
// mimic _loadContextEntriesWhereNeeded from Timeline.js
for (const entry of eventEntries) {
if (!entry.contextEventId) {
continue;
}
const id = entry.contextEventId;
let contextEvent = eventEntries.find(e => e.id === id);
if (contextEvent) {
entry.setContextEntry(contextEvent);
// we don't emit an update here, as the add or update
// that the callee will emit hasn't been emitted yet.
}
}
const rawTiles = eventEntries
.map((entry) => {
return tilesCreator(entry);