Merge pull request #11495 from matrix-org/germain-gg/fix-right-panel-member

Move ViewUser action callback to RoomView
This commit is contained in:
Andy Balaam
2023-09-15 11:37:26 +01:00
committed by GitHub
6 changed files with 59 additions and 91 deletions

View File

@@ -29,6 +29,7 @@ import {
convertToStatePanel,
convertToStorePanel,
IRightPanelCard,
IRightPanelCardState,
IRightPanelForRoom,
} from "./RightPanelStoreIPanelState";
import { ActionPayload } from "../../dispatcher/payloads";
@@ -226,6 +227,24 @@ export default class RightPanelStore extends ReadyWatchingStore {
}
}
/**
* Helper to show a right panel phase.
* If the UI is already showing that phase, the right panel will be hidden.
*
* Calling the same phase twice with a different state will update the current
* phase and push the old state in the right panel history.
* @param phase The right panel phase.
* @param cardState The state within the phase.
*/
public showOrHidePanel(phase: RightPanelPhases, cardState?: Partial<IRightPanelCardState>): void {
if (this.currentCard.phase == phase && !cardState && this.isOpen) {
this.togglePanel(null);
} else {
this.setCard({ phase, state: cardState });
if (!this.isOpen) this.togglePanel(null);
}
}
private loadCacheFromSettings(): void {
if (this.viewedRoomId) {
const room = this.mxClient?.getRoom(this.viewedRoomId);