Fix RoomViewStore forgetting some details of a view room call (#7512)
This commit is contained in:
parent
3a18fd8f71
commit
ec6c1b8272
21 changed files with 67 additions and 57 deletions
|
@ -362,44 +362,43 @@ export default class RightPanelStore extends ReadyWatchingStore {
|
|||
// this.loadCacheFromSettings();
|
||||
};
|
||||
|
||||
onDispatch(payload: ActionPayload) {
|
||||
onDispatch = (payload: ActionPayload) => {
|
||||
switch (payload.action) {
|
||||
case 'view_group':
|
||||
case Action.ViewRoom: {
|
||||
const _this = RightPanelStore.instance;
|
||||
if (payload.room_id === _this.viewedRoomId) break; // skip this transition, probably a permalink
|
||||
if (payload.room_id === this.viewedRoomId) break; // skip this transition, probably a permalink
|
||||
|
||||
// Put group in the same/similar view to what was open from the previously viewed room
|
||||
// Is contradictory to the new "per room" philosophy but it is the legacy behavior for groups.
|
||||
if ((_this.isViewingRoom ? Action.ViewRoom : "view_group") != payload.action) {
|
||||
if (payload.action == Action.ViewRoom && MEMBER_INFO_PHASES.includes(_this.currentCard?.phase)) {
|
||||
if ((this.isViewingRoom ? Action.ViewRoom : "view_group") != payload.action) {
|
||||
if (payload.action == Action.ViewRoom && MEMBER_INFO_PHASES.includes(this.currentCard?.phase)) {
|
||||
// switch from group to room
|
||||
_this.setRightPanelCache({ phase: RightPanelPhases.RoomMemberList, state: {} });
|
||||
this.setRightPanelCache({ phase: RightPanelPhases.RoomMemberList, state: {} });
|
||||
} else if (
|
||||
payload.action == "view_group" &&
|
||||
_this.currentCard?.phase === RightPanelPhases.GroupMemberInfo
|
||||
this.currentCard?.phase === RightPanelPhases.GroupMemberInfo
|
||||
) {
|
||||
// switch from room to group
|
||||
_this.setRightPanelCache({ phase: RightPanelPhases.GroupMemberList, state: {} });
|
||||
this.setRightPanelCache({ phase: RightPanelPhases.GroupMemberList, state: {} });
|
||||
}
|
||||
}
|
||||
|
||||
// Update the current room here, so that all the other functions dont need to be room dependant.
|
||||
// The right panel store always will return the state for the current room.
|
||||
_this.viewedRoomId = payload.room_id;
|
||||
_this.isViewingRoom = payload.action == Action.ViewRoom;
|
||||
this.viewedRoomId = payload.room_id;
|
||||
this.isViewingRoom = payload.action == Action.ViewRoom;
|
||||
// load values from byRoomCache with the viewedRoomId.
|
||||
if (_this.isReady) {
|
||||
if (this.isReady) {
|
||||
// we need the client to be ready to get the events form the ids of the settings
|
||||
// the loading will be done in the onReady function (to catch up with the changes done here before it was ready)
|
||||
// all the logic in this case is not necessary anymore as soon as groups are dropped and we use: onRoomViewStoreUpdate
|
||||
_this.loadCacheFromSettings();
|
||||
_this.emitAndUpdateSettings();
|
||||
this.loadCacheFromSettings();
|
||||
this.emitAndUpdateSettings();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static get instance(): RightPanelStore {
|
||||
if (!RightPanelStore.internalInstance) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue