Skip to content

Commit

Permalink
remove code we do not need yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Dec 16, 2024
1 parent 9bac94a commit 5d1df49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 111 deletions.
86 changes: 0 additions & 86 deletions spec/unit/matrixrtc/MatrixRTCSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,92 +950,6 @@ describe("MatrixRTCSession", () => {
}
});

it("re-sends key if a member changes membership ID", async () => {
return "membershipID is not a thing anymore";
/*
jest.useFakeTimers();
try {
const keysSentPromise1 = new Promise((resolve) => {
sendEventMock.mockImplementation(resolve);
});
const member1 = membershipTemplate;
const member2 = {
...membershipTemplate,
device_id: "BBBBBBB",
};
const mockRoom = makeMockRoom([member1, member2]);
mockRoom.getLiveTimeline().getState = jest
.fn()
.mockReturnValue(makeMockRoomState([member1, member2], mockRoom.roomId));
sess = MatrixRTCSession.roomSessionForRoom(client, mockRoom);
sess.joinRoomSession([mockFocus], mockFocus, { manageMediaKeys: true });
await keysSentPromise1;
// make sure an encryption key was sent
expect(sendEventMock).toHaveBeenCalledWith(
expect.stringMatching(".*"),
"io.element.call.encryption_keys",
{
call_id: "",
device_id: "AAAAAAA",
keys: [
{
index: 0,
key: expect.stringMatching(".*"),
},
],
sent_ts: Date.now(),
},
);
expect(sess!.statistics.counters.roomEventEncryptionKeysSent).toEqual(1);
sendEventMock.mockClear();
// this should be a no-op:
sess.onMembershipUpdate();
expect(sendEventMock).toHaveBeenCalledTimes(0);
// advance time to avoid key throttling
jest.advanceTimersByTime(10000);
// update membership ID
member2.membershipID = "newID";
const keysSentPromise2 = new Promise((resolve) => {
sendEventMock.mockImplementation(resolve);
});
// this should re-send the key
sess.onMembershipUpdate();
await keysSentPromise2;
expect(sendEventMock).toHaveBeenCalledWith(
expect.stringMatching(".*"),
"io.element.call.encryption_keys",
{
call_id: "",
device_id: "AAAAAAA",
keys: [
{
index: 0,
key: expect.stringMatching(".*"),
},
],
sent_ts: Date.now(),
},
);
expect(sess!.statistics.counters.roomEventEncryptionKeysSent).toEqual(2);
} finally {
jest.useRealTimers();
}
*/
});

it("re-sends key if a member changes created_ts", async () => {
jest.useFakeTimers();
jest.setSystemTime(1000);
Expand Down
25 changes: 0 additions & 25 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,31 +911,6 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
};
}

/**
* Returns true if our membership event needs to be updated
*/
// private membershipEventNeedsUpdate(
// myPrevMembershipData?: SessionMembershipData,
// myPrevMembership?: CallMembership,
// ): boolean {
// if (myPrevMembership && myPrevMembership.getMsUntilExpiry() === undefined) return false;

// // Need to update if there's a membership for us but we're not joined (valid or otherwise)
// if (!this.isJoined()) return !!myPrevMembershipData;

// // ...or if we are joined, but there's no valid membership event
// if (!myPrevMembership) return true;

// const expiryTime = myPrevMembership.getMsUntilExpiry();
// if (expiryTime !== undefined && expiryTime < this.membershipExpiryTimeout / 2) {
// // ...or if the expiry time needs bumping
// this.relativeExpiry! += this.membershipExpiryTimeout;
// return true;
// }

// return false;
// }

private makeNewMembership(deviceId: string): SessionMembershipData | {} {
// If we're joined, add our own
if (this.isJoined()) {
Expand Down

0 comments on commit 5d1df49

Please sign in to comment.