Only display RoomKnocksBar when feature flag is enabled (#11513)

This commit is contained in:
Andy Balaam 2023-09-01 13:03:53 +01:00 committed by GitHub
parent fbe5a7d4b8
commit ce8d07fa72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -480,6 +480,7 @@ export interface IProps {
interface IState { interface IState {
contextMenuPosition?: DOMRect; contextMenuPosition?: DOMRect;
rightPanelOpen: boolean; rightPanelOpen: boolean;
featureAskToJoin: boolean;
} }
/** /**
@ -496,6 +497,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
public static contextType = RoomContext; public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>; public context!: React.ContextType<typeof RoomContext>;
private readonly client = this.props.room.client; private readonly client = this.props.room.client;
private readonly featureAskToJoinWatcher: string;
public constructor(props: IProps, context: IState) { public constructor(props: IProps, context: IState) {
super(props, context); super(props, context);
@ -503,7 +505,15 @@ export default class RoomHeader extends React.Component<IProps, IState> {
notiStore.on(NotificationStateEvents.Update, this.onNotificationUpdate); notiStore.on(NotificationStateEvents.Update, this.onNotificationUpdate);
this.state = { this.state = {
rightPanelOpen: RightPanelStore.instance.isOpen, rightPanelOpen: RightPanelStore.instance.isOpen,
featureAskToJoin: SettingsStore.getValue("feature_ask_to_join"),
}; };
this.featureAskToJoinWatcher = SettingsStore.watchSetting(
"feature_ask_to_join",
null,
(_settingName, _roomId, _atLevel, _newValAtLevel, featureAskToJoin) => {
this.setState({ featureAskToJoin });
},
);
} }
public componentDidMount(): void { public componentDidMount(): void {
@ -516,6 +526,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
const notiStore = RoomNotificationStateStore.instance.getRoomState(this.props.room); const notiStore = RoomNotificationStateStore.instance.getRoomState(this.props.room);
notiStore.removeListener(NotificationStateEvents.Update, this.onNotificationUpdate); notiStore.removeListener(NotificationStateEvents.Update, this.onNotificationUpdate);
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate); RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
SettingsStore.unwatchSetting(this.featureAskToJoinWatcher);
} }
private onRightPanelStoreUpdate = (): void => { private onRightPanelStoreUpdate = (): void => {
@ -821,7 +832,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
</div> </div>
{!isVideoRoom && <RoomCallBanner roomId={this.props.room.roomId} />} {!isVideoRoom && <RoomCallBanner roomId={this.props.room.roomId} />}
<RoomLiveShareWarning roomId={this.props.room.roomId} /> <RoomLiveShareWarning roomId={this.props.room.roomId} />
<RoomKnocksBar room={this.props.room} /> {this.state.featureAskToJoin && <RoomKnocksBar room={this.props.room} />}
</header> </header>
); );
} }