Make displayname and avatars show up and handle avatar changes
This commit is contained in:
parent
1c7c6bf440
commit
f80f9fbbb6
|
@ -68,7 +68,7 @@ async function fetchEventsForTimestamp(roomId, ts) {
|
||||||
const stateEventMap = {};
|
const stateEventMap = {};
|
||||||
for (const stateEvent of messageResData.state) {
|
for (const stateEvent of messageResData.state) {
|
||||||
if (stateEvent.type === 'm.room.member') {
|
if (stateEvent.type === 'm.room.member') {
|
||||||
stateEventMap[stateEvent.state_key] = stateEventMap;
|
stateEventMap[stateEvent.state_key] = stateEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,16 @@ async function mountHydrogen() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Something we can modify with new state updates as we see them
|
||||||
|
const workingStateEventMap = {
|
||||||
|
...stateEventMap,
|
||||||
|
};
|
||||||
const eventEntries = events.map((event) => {
|
const eventEntries = events.map((event) => {
|
||||||
const memberEvent = stateEventMap[event.user_id];
|
if (event.type === 'm.room.member') {
|
||||||
|
workingStateEventMap[event.state_key] = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
const memberEvent = workingStateEventMap[event.user_id];
|
||||||
return makeEventEntryFromEventJson(event, memberEvent);
|
return makeEventEntryFromEventJson(event, memberEvent);
|
||||||
});
|
});
|
||||||
//console.log('eventEntries', eventEntries);
|
//console.log('eventEntries', eventEntries);
|
||||||
|
|
|
@ -16,7 +16,7 @@ app.get(
|
||||||
asyncHandler(async function (req, res) {
|
asyncHandler(async function (req, res) {
|
||||||
const { events, stateEventMap } = await fetchEventsForTimestamp(
|
const { events, stateEventMap } = await fetchEventsForTimestamp(
|
||||||
'!HBehERstyQBxyJDLfR:my.synapse.server',
|
'!HBehERstyQBxyJDLfR:my.synapse.server',
|
||||||
new Date('2022-01-01').getTime()
|
new Date('2022-02-08').getTime()
|
||||||
);
|
);
|
||||||
|
|
||||||
const hydrogenHtmlOutput = await renderHydrogenToString(events, stateEventMap);
|
const hydrogenHtmlOutput = await renderHydrogenToString(events, stateEventMap);
|
||||||
|
|
Loading…
Reference in New Issue