Add a developer mode flag and use it for accessing space timelines (#6994)
Fixes https://github.com/vector-im/element-web/issues/19416
This commit is contained in:
parent
96bd052ecf
commit
d188d32423
7 changed files with 43 additions and 1 deletions
|
@ -108,6 +108,7 @@ interface IProps {
|
||||||
currentGroupIsNew?: boolean;
|
currentGroupIsNew?: boolean;
|
||||||
justRegistered?: boolean;
|
justRegistered?: boolean;
|
||||||
roomJustCreatedOpts?: IOpts;
|
roomJustCreatedOpts?: IOpts;
|
||||||
|
forceTimeline?: boolean; // see props on MatrixChat
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUsageLimit {
|
interface IUsageLimit {
|
||||||
|
@ -611,6 +612,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
key={this.props.currentRoomId || 'roomview'}
|
key={this.props.currentRoomId || 'roomview'}
|
||||||
resizeNotifier={this.props.resizeNotifier}
|
resizeNotifier={this.props.resizeNotifier}
|
||||||
justCreatedOpts={this.props.roomJustCreatedOpts}
|
justCreatedOpts={this.props.roomJustCreatedOpts}
|
||||||
|
forceTimeline={this.props.forceTimeline}
|
||||||
/>;
|
/>;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,9 @@ interface IRoomInfo {
|
||||||
threepid_invite?: IThreepidInvite;
|
threepid_invite?: IThreepidInvite;
|
||||||
|
|
||||||
justCreatedOpts?: IOpts;
|
justCreatedOpts?: IOpts;
|
||||||
|
|
||||||
|
// Whether or not to override default behaviour to end up at a timeline
|
||||||
|
forceTimeline?: boolean;
|
||||||
}
|
}
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
|
|
||||||
|
@ -238,6 +241,7 @@ interface IState {
|
||||||
pendingInitialSync?: boolean;
|
pendingInitialSync?: boolean;
|
||||||
justRegistered?: boolean;
|
justRegistered?: boolean;
|
||||||
roomJustCreatedOpts?: IOpts;
|
roomJustCreatedOpts?: IOpts;
|
||||||
|
forceTimeline?: boolean; // see props
|
||||||
}
|
}
|
||||||
|
|
||||||
@replaceableComponent("structures.MatrixChat")
|
@replaceableComponent("structures.MatrixChat")
|
||||||
|
@ -968,6 +972,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
page_type: PageType.RoomView,
|
page_type: PageType.RoomView,
|
||||||
threepidInvite: roomInfo.threepid_invite,
|
threepidInvite: roomInfo.threepid_invite,
|
||||||
roomOobData: roomInfo.oob_data,
|
roomOobData: roomInfo.oob_data,
|
||||||
|
forceTimeline: roomInfo.forceTimeline,
|
||||||
ready: true,
|
ready: true,
|
||||||
roomJustCreatedOpts: roomInfo.justCreatedOpts,
|
roomJustCreatedOpts: roomInfo.justCreatedOpts,
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|
|
@ -110,6 +110,8 @@ interface IRoomProps extends MatrixClientProps {
|
||||||
resizeNotifier: ResizeNotifier;
|
resizeNotifier: ResizeNotifier;
|
||||||
justCreatedOpts?: IOpts;
|
justCreatedOpts?: IOpts;
|
||||||
|
|
||||||
|
forceTimeline?: boolean; // should we force access to the timeline, overriding (for eg) spaces
|
||||||
|
|
||||||
// Called with the credentials of a registered user (if they were a ROU that transitioned to PWLU)
|
// Called with the credentials of a registered user (if they were a ROU that transitioned to PWLU)
|
||||||
onRegistered?(credentials: IMatrixClientCreds): void;
|
onRegistered?(credentials: IMatrixClientCreds): void;
|
||||||
}
|
}
|
||||||
|
@ -1911,7 +1913,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.room?.isSpaceRoom()) {
|
if (this.state.room?.isSpaceRoom() && !this.props.forceTimeline) {
|
||||||
return <SpaceRoomView
|
return <SpaceRoomView
|
||||||
space={this.state.room}
|
space={this.state.room}
|
||||||
justCreatedOpts={this.props.justCreatedOpts}
|
justCreatedOpts={this.props.justCreatedOpts}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import { SetRightPanelPhasePayload } from "../../../dispatcher/payloads/SetRight
|
||||||
import { Action } from "../../../dispatcher/actions";
|
import { Action } from "../../../dispatcher/actions";
|
||||||
import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
|
import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
|
||||||
import { BetaPill } from "../beta/BetaCard";
|
import { BetaPill } from "../beta/BetaCard";
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
|
||||||
interface IProps extends IContextMenuProps {
|
interface IProps extends IContextMenuProps {
|
||||||
space: Room;
|
space: Room;
|
||||||
|
@ -105,6 +106,29 @@ const SpaceContextMenu = ({ space, onFinished, ...props }: IProps) => {
|
||||||
</IconizedContextMenuOptionList>;
|
</IconizedContextMenuOptionList>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let devtoolsSection;
|
||||||
|
if (SettingsStore.getValue("developerMode")) {
|
||||||
|
const onViewTimelineClick = (ev: ButtonEvent) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
defaultDispatcher.dispatch({
|
||||||
|
action: 'view_room',
|
||||||
|
room_id: space.roomId,
|
||||||
|
forceTimeline: true,
|
||||||
|
});
|
||||||
|
onFinished();
|
||||||
|
};
|
||||||
|
|
||||||
|
devtoolsSection = <IconizedContextMenuOptionList first>
|
||||||
|
<IconizedContextMenuOption
|
||||||
|
iconClassName="mx_SpacePanel_iconSettings"
|
||||||
|
label={_t("See room timeline (devtools)")}
|
||||||
|
onClick={onViewTimelineClick}
|
||||||
|
/>
|
||||||
|
</IconizedContextMenuOptionList>;
|
||||||
|
}
|
||||||
|
|
||||||
const canAddRooms = space.currentState.maySendStateEvent(EventType.SpaceChild, userId);
|
const canAddRooms = space.currentState.maySendStateEvent(EventType.SpaceChild, userId);
|
||||||
|
|
||||||
let newRoomSection;
|
let newRoomSection;
|
||||||
|
@ -209,6 +233,7 @@ const SpaceContextMenu = ({ space, onFinished, ...props }: IProps) => {
|
||||||
</IconizedContextMenuOptionList>
|
</IconizedContextMenuOptionList>
|
||||||
{ newRoomSection }
|
{ newRoomSection }
|
||||||
{ leaveSection }
|
{ leaveSection }
|
||||||
|
{ devtoolsSection }
|
||||||
</IconizedContextMenu>;
|
</IconizedContextMenu>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ export default class LabsUserSettingsTab extends React.Component<{}, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
labsSection = <div className="mx_SettingsTab_section">
|
labsSection = <div className="mx_SettingsTab_section">
|
||||||
|
<SettingsFlag name="developerMode" level={SettingLevel.ACCOUNT} />
|
||||||
{ flags }
|
{ flags }
|
||||||
<SettingsFlag name="enableWidgetScreenshots" level={SettingLevel.ACCOUNT} />
|
<SettingsFlag name="enableWidgetScreenshots" level={SettingLevel.ACCOUNT} />
|
||||||
<SettingsFlag name="showHiddenEventsInTimeline" level={SettingLevel.DEVICE} />
|
<SettingsFlag name="showHiddenEventsInTimeline" level={SettingLevel.DEVICE} />
|
||||||
|
|
|
@ -886,6 +886,7 @@
|
||||||
"All rooms you're in will appear in Home.": "All rooms you're in will appear in Home.",
|
"All rooms you're in will appear in Home.": "All rooms you're in will appear in Home.",
|
||||||
"Display Communities instead of Spaces": "Display Communities instead of Spaces",
|
"Display Communities instead of Spaces": "Display Communities instead of Spaces",
|
||||||
"Temporarily show communities instead of Spaces for this session. Support for this will be removed in the near future. This will reload Element.": "Temporarily show communities instead of Spaces for this session. Support for this will be removed in the near future. This will reload Element.",
|
"Temporarily show communities instead of Spaces for this session. Support for this will be removed in the near future. This will reload Element.": "Temporarily show communities instead of Spaces for this session. Support for this will be removed in the near future. This will reload Element.",
|
||||||
|
"Developer mode": "Developer mode",
|
||||||
"Collecting app version information": "Collecting app version information",
|
"Collecting app version information": "Collecting app version information",
|
||||||
"Collecting logs": "Collecting logs",
|
"Collecting logs": "Collecting logs",
|
||||||
"Uploading logs": "Uploading logs",
|
"Uploading logs": "Uploading logs",
|
||||||
|
@ -2701,6 +2702,7 @@
|
||||||
"Collapse reply thread": "Collapse reply thread",
|
"Collapse reply thread": "Collapse reply thread",
|
||||||
"Report": "Report",
|
"Report": "Report",
|
||||||
"View in room": "View in room",
|
"View in room": "View in room",
|
||||||
|
"See room timeline (devtools)": "See room timeline (devtools)",
|
||||||
"Add space": "Add space",
|
"Add space": "Add space",
|
||||||
"Manage & explore rooms": "Manage & explore rooms",
|
"Manage & explore rooms": "Manage & explore rooms",
|
||||||
"Clear status": "Clear status",
|
"Clear status": "Clear status",
|
||||||
|
|
|
@ -757,6 +757,11 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
default: false,
|
default: false,
|
||||||
controller: new ReloadOnChangeController(),
|
controller: new ReloadOnChangeController(),
|
||||||
},
|
},
|
||||||
|
"developerMode": {
|
||||||
|
displayName: _td("Developer mode"),
|
||||||
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
[UIFeature.RoomHistorySettings]: {
|
[UIFeature.RoomHistorySettings]: {
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue