mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 06:49:52 +01:00
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">
|
||||
<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>
|
||||
</form>
|
||||
<div className="invite-user__search-status">
|
||||
|
|
|
@ -177,10 +177,10 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
|||
onRequestClose();
|
||||
}
|
||||
|
||||
function joinChannel(roomId) {
|
||||
joiningChannels.add(roomId);
|
||||
function joinChannel(roomIdOrAlias) {
|
||||
joiningChannels.add(roomIdOrAlias);
|
||||
updateJoiningChannels(new Set(Array.from(joiningChannels)));
|
||||
roomActions.join(roomId, false);
|
||||
roomActions.join(roomIdOrAlias, false);
|
||||
}
|
||||
|
||||
function renderChannelList(channels) {
|
||||
|
@ -199,7 +199,7 @@ function PublicChannels({ isOpen, searchTerm, onRequestClose }) {
|
|||
options={(
|
||||
<>
|
||||
{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) {
|
||||
const mx = initMatrix.matrixClient;
|
||||
const roomIdParts = roomIdOrAlias.split(':');
|
||||
try {
|
||||
const resultRoom = await mx.joinRoom(roomIdOrAlias);
|
||||
const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers: [roomIdParts[1]] });
|
||||
|
||||
if (isDM) {
|
||||
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());
|
||||
|
|
Loading…
Reference in a new issue