Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ed7a21a

Browse files
authored
Remove spurious type casts and avoid deprecated symbols (#12513)
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 113299d commit ed7a21a

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

src/components/views/rooms/RoomHeader/CallGuestLinkButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { Icon as ExternalLinkIcon } from "@vector-im/compound-design-tokens/icon
1717
import { Button, IconButton, Tooltip } from "@vector-im/compound-web";
1818
import React, { useCallback } from "react";
1919
import { logger } from "matrix-js-sdk/src/logger";
20-
import { EventType, IJoinRuleEventContent, JoinRule, Room } from "matrix-js-sdk/src/matrix";
20+
import { EventType, JoinRule, Room } from "matrix-js-sdk/src/matrix";
2121

2222
import Modal from "../../../../Modal";
2323
import ShareDialog from "../../dialogs/ShareDialog";
@@ -118,7 +118,7 @@ export const JoinRuleDialog: React.FC<{
118118
EventType.RoomJoinRules,
119119
{
120120
join_rule: newRule,
121-
} as IJoinRuleEventContent,
121+
},
122122
"",
123123
);
124124
// Show the dialog for a bit to give the user feedback

src/components/views/rooms/RoomPreviewBar.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@ limitations under the License.
1515
*/
1616

1717
import React, { ChangeEvent, ReactNode } from "react";
18-
import {
19-
Room,
20-
RoomMember,
21-
EventType,
22-
RoomType,
23-
IJoinRuleEventContent,
24-
JoinRule,
25-
MatrixError,
26-
} from "matrix-js-sdk/src/matrix";
27-
import { KnownMembership } from "matrix-js-sdk/src/types";
18+
import { Room, RoomMember, EventType, RoomType, JoinRule, MatrixError } from "matrix-js-sdk/src/matrix";
19+
import { KnownMembership, RoomJoinRulesEventContent } from "matrix-js-sdk/src/types";
2820
import classNames from "classnames";
2921
import { RoomPreviewOpts, RoomViewLifecycle } from "@matrix-org/react-sdk-module-api/lib/lifecycles/RoomViewLifecycle";
3022

@@ -257,7 +249,7 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
257249
return (
258250
this.props.room?.currentState
259251
.getStateEvents(EventType.RoomJoinRules, "")
260-
?.getContent<IJoinRuleEventContent>().join_rule ?? null
252+
?.getContent<RoomJoinRulesEventContent>().join_rule ?? null
261253
);
262254
}
263255

src/components/views/settings/JoinRuleSettings.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ limitations under the License.
1515
*/
1616

1717
import React, { ReactNode, useEffect, useState } from "react";
18-
import {
19-
IJoinRuleEventContent,
20-
JoinRule,
21-
RestrictedAllowType,
22-
Room,
23-
EventType,
24-
Visibility,
25-
} from "matrix-js-sdk/src/matrix";
18+
import { JoinRule, RestrictedAllowType, Room, EventType, Visibility } from "matrix-js-sdk/src/matrix";
19+
import { RoomJoinRulesEventContent } from "matrix-js-sdk/src/types";
2620

2721
import StyledRadioGroup, { IDefinition } from "../elements/StyledRadioGroup";
2822
import { _t } from "../../../languageHandler";
@@ -72,7 +66,7 @@ const JoinRuleSettings: React.FC<JoinRuleSettingsProps> = ({
7266

7367
const disabled = !room.currentState.mayClientSendStateEvent(EventType.RoomJoinRules, cli);
7468

75-
const [content, setContent] = useLocalEcho<IJoinRuleEventContent | undefined, IJoinRuleEventContent>(
69+
const [content, setContent] = useLocalEcho<RoomJoinRulesEventContent | undefined, RoomJoinRulesEventContent>(
7670
() => room.currentState.getStateEvents(EventType.RoomJoinRules, "")?.getContent(),
7771
(content) => cli.sendStateEvent(room.roomId, EventType.RoomJoinRules, content, ""),
7872
onError,
@@ -391,7 +385,7 @@ const JoinRuleSettings: React.FC<JoinRuleSettingsProps> = ({
391385
if (beforeJoinRule === joinRule && !restrictedAllowRoomIds) return;
392386
if (beforeChange && !(await beforeChange(joinRule))) return;
393387

394-
const newContent: IJoinRuleEventContent = {
388+
const newContent: RoomJoinRulesEventContent = {
395389
join_rule: joinRule,
396390
};
397391

0 commit comments

Comments
 (0)