You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Fix the state shown for call in rooms (#10833)
* Fix the state shown for call in rooms We split out a separate state for 'missed' separate to 'ended' which caused confusion as the state got set to this when it shouldn't have, so calls that wouldn't have been shown as missed were. Remove the csutom call state and just have the missed state as a variant of the ended state. Re-order the if clauses so they hit the right ones. Also don't pass the callState variable into renderContent() which is a class method and so has access to the same info anyway. * Fix test * i18n (reorder only) * Fix test * Fix types * Add test for legacy call event tile
This commit is contained in:
@ -20,7 +20,7 @@ import { CallState } from "matrix-js-sdk/src/webrtc/call";
|
||||
|
||||
import { stubClient } from "../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
|
||||
import LegacyCallEventGrouper, { CustomCallState } from "../../../src/components/structures/LegacyCallEventGrouper";
|
||||
import LegacyCallEventGrouper from "../../../src/components/structures/LegacyCallEventGrouper";
|
||||
|
||||
const MY_USER_ID = "@me:here";
|
||||
const THEIR_USER_ID = "@they:here";
|
||||
@ -39,6 +39,9 @@ describe("LegacyCallEventGrouper", () => {
|
||||
it("detects a missed call", () => {
|
||||
const grouper = new LegacyCallEventGrouper();
|
||||
|
||||
// This assumes that the other party aborted the call by sending a hangup,
|
||||
// which is the usual case. Another possible test would be for the edge
|
||||
// case where there is only an expired invite event.
|
||||
grouper.add({
|
||||
getContent: () => {
|
||||
return {
|
||||
@ -52,8 +55,22 @@ describe("LegacyCallEventGrouper", () => {
|
||||
userId: THEIR_USER_ID,
|
||||
},
|
||||
} as unknown as MatrixEvent);
|
||||
grouper.add({
|
||||
getContent: () => {
|
||||
return {
|
||||
call_id: "callId",
|
||||
};
|
||||
},
|
||||
getType: () => {
|
||||
return EventType.CallHangup;
|
||||
},
|
||||
sender: {
|
||||
userId: THEIR_USER_ID,
|
||||
},
|
||||
} as unknown as MatrixEvent);
|
||||
|
||||
expect(grouper.state).toBe(CustomCallState.Missed);
|
||||
expect(grouper.state).toBe(CallState.Ended);
|
||||
expect(grouper.callWasMissed).toBe(true);
|
||||
});
|
||||
|
||||
it("detects an ended call", () => {
|
||||
|
Reference in New Issue
Block a user