No known servers on channel join bug fixed
This commit is contained in:
parent
7fddf80c09
commit
419e25df23
3 changed files with 7 additions and 6 deletions
|
@ -230,7 +230,7 @@ function InviteUser({
|
||||||
>
|
>
|
||||||
<div className="invite-user">
|
<div className="invite-user">
|
||||||
<form className="invite-user__form" onSubmit={(e) => { e.preventDefault(); searchUser(usernameRef.current.value); }}>
|
<form className="invite-user__form" onSubmit={(e) => { e.preventDefault(); searchUser(usernameRef.current.value); }}>
|
||||||
<Input value={searchTerm} forwardRef={usernameRef} label="Username or userId" />
|
<Input value={searchTerm} forwardRef={usernameRef} label="Name or userId" />
|
||||||
<Button disabled={isSearching} iconSrc={UserIC} variant="primary" type="submit">Search</Button>
|
<Button disabled={isSearching} iconSrc={UserIC} variant="primary" type="submit">Search</Button>
|
||||||
</form>
|
</form>
|
||||||
<div className="invite-user__search-status">
|
<div className="invite-user__search-status">
|
||||||
|
|
|
@ -177,10 +177,10 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
||||||
onRequestClose();
|
onRequestClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
function joinChannel(roomId) {
|
function joinChannel(roomIdOrAlias) {
|
||||||
joiningChannels.add(roomId);
|
joiningChannels.add(roomIdOrAlias);
|
||||||
updateJoiningChannels(new Set(Array.from(joiningChannels)));
|
updateJoiningChannels(new Set(Array.from(joiningChannels)));
|
||||||
roomActions.join(roomId, false);
|
roomActions.join(roomIdOrAlias, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChannelList(channels) {
|
function renderChannelList(channels) {
|
||||||
|
@ -199,7 +199,7 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
||||||
options={(
|
options={(
|
||||||
<>
|
<>
|
||||||
{isJoined && <Button onClick={() => handleViewChannel(channel.room_id)}>Open</Button>}
|
{isJoined && <Button onClick={() => handleViewChannel(channel.room_id)}>Open</Button>}
|
||||||
{!isJoined && (joiningChannels.has(channel.room_id) ? <Spinner size="small" /> : <Button onClick={() => joinChannel(channel.room_id)} variant="primary">Join</Button>)}
|
{!isJoined && (joiningChannels.has(channel.room_id) ? <Spinner size="small" /> : <Button onClick={() => joinChannel(channel.aliases?.[0] || channel.room_id)} variant="primary">Join</Button>)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -85,8 +85,9 @@ function guessDMRoomTargetId(room, myUserId) {
|
||||||
*/
|
*/
|
||||||
async function join(roomIdOrAlias, isDM) {
|
async function join(roomIdOrAlias, isDM) {
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
|
const roomIdParts = roomIdOrAlias.split(':');
|
||||||
try {
|
try {
|
||||||
const resultRoom = await mx.joinRoom(roomIdOrAlias);
|
const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers: [roomIdParts[1]] });
|
||||||
|
|
||||||
if (isDM) {
|
if (isDM) {
|
||||||
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
||||||
|
|
Loading…
Reference in a new issue