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