Merge branch 'master' of https://github.com/archem-team/revolt-revite into feature/pin_message
commit
e80bfc4daa
|
|
@ -37,7 +37,6 @@ export default function CreateInvite({
|
||||||
}: ModalProps<"create_invite">) {
|
}: ModalProps<"create_invite">) {
|
||||||
const [processing, setProcessing] = useState(false);
|
const [processing, setProcessing] = useState(false);
|
||||||
const [code, setCode] = useState("abcdef");
|
const [code, setCode] = useState("abcdef");
|
||||||
const [url, setUrl] = useState("abcdef");
|
|
||||||
|
|
||||||
// Generate an invite code
|
// Generate an invite code
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -45,10 +44,7 @@ export default function CreateInvite({
|
||||||
|
|
||||||
target
|
target
|
||||||
.createInvite()
|
.createInvite()
|
||||||
.then((res) => {
|
.then(({ _id }) => setCode(_id))
|
||||||
setUrl(res.url || "default_url");
|
|
||||||
setCode(res._id || "default_code");
|
|
||||||
})
|
|
||||||
.catch((err) =>
|
.catch((err) =>
|
||||||
modalController.push({ type: "error", error: takeError(err) }),
|
modalController.push({ type: "error", error: takeError(err) }),
|
||||||
)
|
)
|
||||||
|
|
@ -69,7 +65,7 @@ export default function CreateInvite({
|
||||||
) : (
|
) : (
|
||||||
<Invite>
|
<Invite>
|
||||||
<Text id="app.special.modals.prompt.create_invite_created" />
|
<Text id="app.special.modals.prompt.create_invite_created" />
|
||||||
<code style="font-size:14px">{url}</code>
|
<code style="font-size:14px">https://{window.location.host}/invite/{code}</code>
|
||||||
</Invite>
|
</Invite>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
@ -83,10 +79,11 @@ export default function CreateInvite({
|
||||||
children: <Text id="app.context_menu.copy_link" />,
|
children: <Text id="app.context_menu.copy_link" />,
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
modalController.writeText(
|
modalController.writeText(
|
||||||
`${url}`
|
`https://${window.location.host}/invite/${code}`
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,10 +99,9 @@ export const Channel = observer(
|
||||||
({ id, server_id }: { id: string; server_id: string }) => {
|
({ id, server_id }: { id: string; server_id: string }) => {
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
const state = useApplicationState();
|
const state = useApplicationState();
|
||||||
|
if (!client.channels.get(id)) {
|
||||||
if (!client.channels.exists(id) && server_id) {
|
|
||||||
if (server_id) {
|
if (server_id) {
|
||||||
const server = client.servers.get(server_id);
|
const server = client.servers.get(server_id);
|
||||||
if (server && server.channel_ids.length > 0) {
|
if (server && server.channel_ids.length > 0) {
|
||||||
let target_id = server.channel_ids[0];
|
let target_id = server.channel_ids[0];
|
||||||
const last_id = state.layout.getLastOpened(server_id);
|
const last_id = state.layout.getLastOpened(server_id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue