Make close button work from user info view
Adds more hacks so that the close button does something vagauely plausible in all situations.
This commit is contained in:
parent
e5d06b1acb
commit
0edb80e541
1 changed files with 21 additions and 4 deletions
|
@ -26,6 +26,7 @@ import dis from '../../dispatcher';
|
||||||
import RateLimitedFunc from '../../ratelimitedfunc';
|
import RateLimitedFunc from '../../ratelimitedfunc';
|
||||||
import { showGroupInviteDialog, showGroupAddRoomDialog } from '../../GroupAddressPicker';
|
import { showGroupInviteDialog, showGroupAddRoomDialog } from '../../GroupAddressPicker';
|
||||||
import GroupStore from '../../stores/GroupStore';
|
import GroupStore from '../../stores/GroupStore';
|
||||||
|
import RoomViewStore from '../../stores/RoomViewStore';
|
||||||
import SettingsStore from "../../settings/SettingsStore";
|
import SettingsStore from "../../settings/SettingsStore";
|
||||||
import {RIGHT_PANEL_PHASES, RIGHT_PANEL_PHASES_NO_ARGS} from "../../stores/RightPanelStorePhases";
|
import {RIGHT_PANEL_PHASES, RIGHT_PANEL_PHASES_NO_ARGS} from "../../stores/RightPanelStorePhases";
|
||||||
import RightPanelStore from "../../stores/RightPanelStore";
|
import RightPanelStore from "../../stores/RightPanelStore";
|
||||||
|
@ -221,10 +222,26 @@ export default class RightPanel extends React.Component {
|
||||||
case RIGHT_PANEL_PHASES.EncryptionPanel:
|
case RIGHT_PANEL_PHASES.EncryptionPanel:
|
||||||
if (SettingsStore.getValue("feature_cross_signing")) {
|
if (SettingsStore.getValue("feature_cross_signing")) {
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
|
// XXX: There are three different ways of 'closing' this panel depending on what state
|
||||||
|
// things are in... this knows far more than it should do about the state of the rest
|
||||||
|
// of the app and is generally a bit silly.
|
||||||
|
if (this.props.user) {
|
||||||
|
// If we have a user prop then we're displaying a user from the 'user' page type
|
||||||
|
// in LoggedInView, so need to change the page type to close the panel (we switch
|
||||||
|
// to the home page which is not obviosuly the correct thing to do, but I'm not sure
|
||||||
|
// anything else is - we could hide the close button altogether?)
|
||||||
|
dis.dispatch({
|
||||||
|
action: "view_home_page",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Otherwise we have got our user from RoomViewStore which means we're being shown
|
||||||
|
// within a room, so go back to the member panel if we were in the encryption panel,
|
||||||
|
// or the member list if we were in the member panel... phew.
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: "view_user",
|
action: "view_user",
|
||||||
member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? this.state.member : null,
|
member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? this.state.member : null,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
panel = <UserInfo
|
panel = <UserInfo
|
||||||
user={this.state.member}
|
user={this.state.member}
|
||||||
|
|
Loading…
Reference in a new issue