mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
fix(invite): fix invite embed logic
This commit is contained in:
parent
0255c3167a
commit
645221b384
1 changed files with 13 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { Group } from "@styled-icons/boxicons-solid";
|
import { Group } from "@styled-icons/boxicons-solid";
|
||||||
import { autorun } from "mobx";
|
import { autorun, reaction } from "mobx";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { RetrievedInvite } from "revolt-api/types/Invites";
|
import { RetrievedInvite } from "revolt-api/types/Invites";
|
||||||
|
@ -147,14 +147,16 @@ export function EmbedInvite({ code }: Props) {
|
||||||
history.push(
|
history.push(
|
||||||
`/server/${invite.server_id}/channel/${invite.channel_id}`,
|
`/server/${invite.server_id}/channel/${invite.channel_id}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dispose = autorun(() => {
|
const dispose = reaction(
|
||||||
const server = client.servers.get(
|
() =>
|
||||||
invite.server_id,
|
client.servers.get(
|
||||||
);
|
invite.server_id,
|
||||||
|
),
|
||||||
defer(() => {
|
(server) => {
|
||||||
if (server) {
|
if (server) {
|
||||||
client.unreads!.markMultipleRead(
|
client.unreads!.markMultipleRead(
|
||||||
server.channel_ids,
|
server.channel_ids,
|
||||||
|
@ -163,11 +165,11 @@ export function EmbedInvite({ code }: Props) {
|
||||||
history.push(
|
history.push(
|
||||||
`/server/${server._id}/channel/${invite.channel_id}`,
|
`/server/${server._id}/channel/${invite.channel_id}`,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dispose();
|
dispose();
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.joinInvite(code);
|
await client.joinInvite(code);
|
||||||
|
|
Loading…
Reference in a new issue