Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Jan 8, 2025
1 parent df213e5 commit da5bc96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions spec/unit/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,8 @@ describe("Crypto", function () {
);
const ksEvent = await keyshareEventForEvent(aliceClient, events[0], 0);
ksEvent.event.sender = claraClient.getUserId()!;
ksEvent.sender = new RoomMember(roomId, claraClient.getUserId()!);
// @ts-ignore - private field access
ksEvent._sender = new RoomMember(roomId, claraClient.getUserId()!);
await bobDecryptor.onRoomKeyEvent(ksEvent);
const key = await bobClient.crypto!.olmDevice.getInboundGroupSessionKey(
roomId,
Expand Down Expand Up @@ -945,7 +946,8 @@ describe("Crypto", function () {

const ksEvent = await keyshareEventForEvent(aliceClient, events[0], 0);
ksEvent.event.sender = aliceClient.getUserId()!;
ksEvent.sender = new RoomMember(roomId, aliceClient.getUserId()!);
// @ts-ignore - private field access
ksEvent._sender = new RoomMember(roomId, aliceClient.getUserId()!);
await bobDecryptor.onRoomKeyEvent(ksEvent);
const key = await bobClient.crypto!.olmDevice.getInboundGroupSessionKey(
roomId,
Expand Down Expand Up @@ -1015,7 +1017,8 @@ describe("Crypto", function () {

const ksEvent = await keyshareEventForEvent(aliceClient, events[0], 0);
ksEvent.event.sender = claraClient.getUserId()!;
ksEvent.sender = new RoomMember(roomId, claraClient.getUserId()!);
// @ts-ignore - private field access
ksEvent._sender = new RoomMember(roomId, claraClient.getUserId()!);
await bobDecryptor.onRoomKeyEvent(ksEvent);
const key = await bobClient.crypto!.olmDevice.getInboundGroupSessionKey(
roomId,
Expand Down
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7351,7 +7351,9 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
// Copy over a known event sender if we can
for (const ev of sr.context.getTimeline()) {
const sender = room.getMember(ev.getSender()!);
if (!ev.sender && sender) ev.sender = sender;
if (!ev.sender && sender) {
ev.setMetadata(room.currentState, false);
}
}
}
searchResults.results.push(sr);
Expand Down
3 changes: 2 additions & 1 deletion src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export function mkMatrixEvent(opts: {
}

const mxEvent = new MatrixEvent(event);
mxEvent.sender = {
// @ts-ignore - private field access
mxEvent._sender = {
userId: opts.sender,
membership: "join",
name: opts.sender,
Expand Down

0 comments on commit da5bc96

Please sign in to comment.