fix(invite): fix invite embed logic
parent
a9343ffcf8
commit
2ada3e963e
|
|
@ -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 New Issue