Say Joining space instead of Joining room where we know its a space
This commit is contained in:
parent
4bb9eeb7a5
commit
28bc8010a7
4 changed files with 28 additions and 13 deletions
|
@ -63,7 +63,13 @@ interface IProps {
|
|||
space: Room;
|
||||
initialText?: string;
|
||||
additionalButtons?: ReactNode;
|
||||
showRoom(cli: MatrixClient, hierarchy: RoomHierarchy, roomId: string, autoJoin?: boolean): void;
|
||||
showRoom(
|
||||
cli: MatrixClient,
|
||||
hierarchy: RoomHierarchy,
|
||||
roomId: string,
|
||||
autoJoin?: boolean,
|
||||
isSpaceRoom?: boolean,
|
||||
): void;
|
||||
}
|
||||
|
||||
interface ITileProps {
|
||||
|
@ -72,7 +78,7 @@ interface ITileProps {
|
|||
selected?: boolean;
|
||||
numChildRooms?: number;
|
||||
hasPermissions?: boolean;
|
||||
onViewRoomClick(autoJoin: boolean): void;
|
||||
onViewRoomClick(autoJoin: boolean, isSpaceRoom: boolean): void;
|
||||
onToggleClick?(): void;
|
||||
}
|
||||
|
||||
|
@ -98,12 +104,12 @@ const Tile: React.FC<ITileProps> = ({
|
|||
const onPreviewClick = (ev: ButtonEvent) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
onViewRoomClick(false);
|
||||
onViewRoomClick(false, room.room_type === RoomType.Space);
|
||||
};
|
||||
const onJoinClick = (ev: ButtonEvent) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
onViewRoomClick(true);
|
||||
onViewRoomClick(true, room.room_type === RoomType.Space);
|
||||
};
|
||||
|
||||
let button;
|
||||
|
@ -280,7 +286,13 @@ const Tile: React.FC<ITileProps> = ({
|
|||
</li>;
|
||||
};
|
||||
|
||||
export const showRoom = (cli: MatrixClient, hierarchy: RoomHierarchy, roomId: string, autoJoin = false) => {
|
||||
export const showRoom = (
|
||||
cli: MatrixClient,
|
||||
hierarchy: RoomHierarchy,
|
||||
roomId: string,
|
||||
autoJoin = false,
|
||||
isSpaceRoom = false,
|
||||
) => {
|
||||
const room = hierarchy.roomMap.get(roomId);
|
||||
|
||||
// Don't let the user view a room they won't be able to either peek or join:
|
||||
|
@ -305,6 +317,7 @@ export const showRoom = (cli: MatrixClient, hierarchy: RoomHierarchy, roomId: st
|
|||
avatarUrl: room.avatar_url,
|
||||
// XXX: This logic is duplicated from the JS SDK which would normally decide what the name is.
|
||||
name: room.name || roomAlias || _t("Unnamed room"),
|
||||
isSpaceRoom,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -315,7 +328,7 @@ interface IHierarchyLevelProps {
|
|||
hierarchy: RoomHierarchy;
|
||||
parents: Set<string>;
|
||||
selectedMap?: Map<string, Set<string>>;
|
||||
onViewRoomClick(roomId: string, autoJoin: boolean): void;
|
||||
onViewRoomClick(roomId: string, autoJoin: boolean, isSpaceRoom: boolean): void;
|
||||
onToggleClick?(parentId: string, childId: string): void;
|
||||
}
|
||||
|
||||
|
@ -353,8 +366,8 @@ export const HierarchyLevel = ({
|
|||
room={room}
|
||||
suggested={hierarchy.isSuggested(root.room_id, room.room_id)}
|
||||
selected={selectedMap?.get(root.room_id)?.has(room.room_id)}
|
||||
onViewRoomClick={(autoJoin) => {
|
||||
onViewRoomClick(room.room_id, autoJoin);
|
||||
onViewRoomClick={(autoJoin, isSpaceRoom) => {
|
||||
onViewRoomClick(room.room_id, autoJoin, isSpaceRoom);
|
||||
}}
|
||||
hasPermissions={hasPermissions}
|
||||
onToggleClick={onToggleClick ? () => onToggleClick(root.room_id, room.room_id) : undefined}
|
||||
|
@ -373,8 +386,8 @@ export const HierarchyLevel = ({
|
|||
}).length}
|
||||
suggested={hierarchy.isSuggested(root.room_id, space.room_id)}
|
||||
selected={selectedMap?.get(root.room_id)?.has(space.room_id)}
|
||||
onViewRoomClick={(autoJoin) => {
|
||||
onViewRoomClick(space.room_id, autoJoin);
|
||||
onViewRoomClick={(autoJoin, isSpaceRoom) => {
|
||||
onViewRoomClick(space.room_id, autoJoin, isSpaceRoom);
|
||||
}}
|
||||
hasPermissions={hasPermissions}
|
||||
onToggleClick={onToggleClick ? () => onToggleClick(root.room_id, space.room_id) : undefined}
|
||||
|
@ -652,8 +665,8 @@ const SpaceHierarchy = ({
|
|||
parents={new Set()}
|
||||
selectedMap={selected}
|
||||
onToggleClick={hasPermissions ? onToggleClick : undefined}
|
||||
onViewRoomClick={(roomId, autoJoin) => {
|
||||
showRoom(cli, hierarchy, roomId, autoJoin);
|
||||
onViewRoomClick={(roomId, autoJoin, isSpaceRoom) => {
|
||||
showRoom(cli, hierarchy, roomId, autoJoin, isSpaceRoom);
|
||||
}}
|
||||
/>
|
||||
</>;
|
||||
|
|
|
@ -323,7 +323,7 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
|
|||
const messageCase = this.getMessageCase();
|
||||
switch (messageCase) {
|
||||
case MessageCase.Joining: {
|
||||
title = _t("Joining room …");
|
||||
title = this.props.oobData.isSpaceRoom ? _t("Joining space …") : _t("Joining room …");
|
||||
showSpinner = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1660,6 +1660,7 @@
|
|||
"%(count)s results|other": "%(count)s results",
|
||||
"%(count)s results|one": "%(count)s result",
|
||||
"This room": "This room",
|
||||
"Joining space …": "Joining space …",
|
||||
"Joining room …": "Joining room …",
|
||||
"Loading …": "Loading …",
|
||||
"Rejecting invite …": "Rejecting invite …",
|
||||
|
|
|
@ -55,6 +55,7 @@ export interface IOOBData {
|
|||
inviterName?: string; // The display name of the person who invited us to the room
|
||||
// eslint-disable-next-line camelcase
|
||||
room_name?: string; // The name of the room, to be used until we are told better by the server
|
||||
isSpaceRoom?: boolean; // Whether or not we think the room is actually a space
|
||||
}
|
||||
|
||||
const STORAGE_PREFIX = "mx_threepid_invite_";
|
||||
|
|
Loading…
Reference in a new issue