1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Expire video member events after 1 hour (#8776)

* Expire video member events after 1 hour

* Iterate based on feedback

* Validate the types of video member events better

* Even more parentheses
This commit is contained in:
Robin
2022-06-09 09:19:52 -04:00
committed by GitHub
parent 12dd5a7ef0
commit d9396b0b54
12 changed files with 344 additions and 244 deletions

View File

@@ -18,7 +18,7 @@ import { EventEmitter } from "events";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { mkEvent } from "./test-utils";
import { VIDEO_CHANNEL_MEMBER } from "../../src/utils/VideoChannelUtils";
import { VIDEO_CHANNEL_MEMBER, STUCK_DEVICE_TIMEOUT_MS } from "../../src/utils/VideoChannelUtils";
import VideoChannelStore, { VideoChannelEvent, IJitsiParticipant } from "../../src/stores/VideoChannelStore";
export class StubVideoChannelStore extends EventEmitter {
@@ -52,11 +52,14 @@ export const stubVideoChannelStore = (): StubVideoChannelStore => {
return store;
};
export const mkVideoChannelMember = (userId: string, devices: string[]): MatrixEvent => mkEvent({
export const mkVideoChannelMember = (userId: string, devices: string[], expiresAt?: number): MatrixEvent => mkEvent({
event: true,
type: VIDEO_CHANNEL_MEMBER,
room: "!1:example.org",
user: userId,
skey: userId,
content: { devices },
content: {
devices,
expires_ts: expiresAt == null ? Date.now() + STUCK_DEVICE_TIMEOUT_MS : expiresAt,
},
});