diff --git a/src/@types/partials.ts b/src/@types/partials.ts index abc3363ef..72fd77168 100644 --- a/src/@types/partials.ts +++ b/src/@types/partials.ts @@ -45,14 +45,6 @@ export enum RestrictedAllowType { RoomMembership = "m.room_membership", } -export interface IJoinRuleEventContent { - join_rule: JoinRule; // eslint-disable-line camelcase - allow?: { - type: RestrictedAllowType; - room_id: string; // eslint-disable-line camelcase - }[]; -} - export enum GuestAccess { CanJoin = "can_join", Forbidden = "forbidden", diff --git a/src/@types/state_events.ts b/src/@types/state_events.ts index 0e077a9e4..f2e5b16b6 100644 --- a/src/@types/state_events.ts +++ b/src/@types/state_events.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { RoomType } from "./event"; -import { GuestAccess, HistoryVisibility, RestrictedAllowType } from "./partials"; +import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "./partials"; import { ImageInfo } from "./media"; import { PolicyRecommendation } from "../models/invites-ignorer"; @@ -36,12 +36,18 @@ export interface RoomCreateEventContent { } export interface RoomJoinRulesEventContent { + join_rule: JoinRule; allow?: { room_id: string; type: RestrictedAllowType; }[]; } +/** + * @deprecated in favour of RoomJoinRulesEventContent + */ +export type IJoinRuleEventContent = RoomJoinRulesEventContent; + export interface RoomMemberEventContent { avatar_url?: string; displayname?: string; diff --git a/src/models/room-state.ts b/src/models/room-state.ts index b6f4d0744..1233ad3bc 100644 --- a/src/models/room-state.ts +++ b/src/models/room-state.ts @@ -20,12 +20,13 @@ import { isNumber, removeHiddenChars } from "../utils"; import { EventType, UNSTABLE_MSC2716_MARKER } from "../@types/event"; import { IEvent, MatrixEvent, MatrixEventEvent } from "./event"; import { MatrixClient } from "../client"; -import { GuestAccess, HistoryVisibility, IJoinRuleEventContent, JoinRule } from "../@types/partials"; +import { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials"; import { TypedEventEmitter } from "./typed-event-emitter"; import { Beacon, BeaconEvent, BeaconEventHandlerMap, getBeaconInfoIdentifier, BeaconIdentifier } from "./beacon"; import { TypedReEmitter } from "../ReEmitter"; import { M_BEACON, M_BEACON_INFO } from "../@types/beacon"; import { KnownMembership } from "../@types/membership"; +import { RoomJoinRulesEventContent } from "../@types/state_events"; export interface IMarkerFoundOptions { /** Whether the timeline was empty before the marker event arrived in the @@ -962,7 +963,7 @@ export class RoomState extends TypedEventEmitter */ public getJoinRule(): JoinRule { const joinRuleEvent = this.getStateEvents(EventType.RoomJoinRules, ""); - const joinRuleContent: Partial = joinRuleEvent?.getContent() ?? {}; + const joinRuleContent: Partial = joinRuleEvent?.getContent() ?? {}; return joinRuleContent["join_rule"] || JoinRule.Invite; }