mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-23 08:41:05 -05:00
Compare commits
4 commits
ac2beaf549
...
f9c2fcec56
Author | SHA1 | Date | |
---|---|---|---|
|
f9c2fcec56 | ||
|
18243f0207 | ||
|
7750276554 | ||
|
97a6c7d399 |
4 changed files with 51 additions and 44 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 07f4343342c3d06a2b540db3bb14f598d745c09a
|
Subproject commit 4ec2f99855825743f65eabd715ec77f61c28c5d8
|
|
@ -27,7 +27,7 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
|
|
||||||
const url = client.generateFileURL(attachment);
|
const url = client.generateFileURL(attachment);
|
||||||
const open_url = `${url}/${filename}`;
|
const open_url = `${url}/${filename}`;
|
||||||
const download_url = url?.replace("attachments", "attachments/download");
|
const download_url = url;
|
||||||
|
|
||||||
const filesize = determineFileSize(size);
|
const filesize = determineFileSize(size);
|
||||||
|
|
||||||
|
@ -49,10 +49,11 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
|
target="_blank"
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
download
|
download
|
||||||
target={isFirefox || window.native ? "_blank" : "_self"}
|
// target={isFirefox || window.native ? "_blank" : "_self"}
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Download size={24} />
|
<Download size={24} />
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Text } from "preact-i18n";
|
||||||
import { Column, H1, IconButton, Modal, Row } from "@revoltchat/ui";
|
import { Column, H1, IconButton, Modal, Row } from "@revoltchat/ui";
|
||||||
|
|
||||||
import Markdown from "../../../components/markdown/Markdown";
|
import Markdown from "../../../components/markdown/Markdown";
|
||||||
|
import { useClient } from "../../client/ClientController";
|
||||||
import { report } from "../../safety";
|
import { report } from "../../safety";
|
||||||
import { modalController } from "../ModalController";
|
import { modalController } from "../ModalController";
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
|
@ -13,6 +14,49 @@ export default function ServerInfo({
|
||||||
server,
|
server,
|
||||||
...props
|
...props
|
||||||
}: ModalProps<"server_info">) {
|
}: ModalProps<"server_info">) {
|
||||||
|
const client = useClient();
|
||||||
|
const isOwner = server.owner === client.user?._id;
|
||||||
|
|
||||||
|
const actions = [
|
||||||
|
{
|
||||||
|
onClick: () => {
|
||||||
|
modalController.push({
|
||||||
|
type: "server_identity",
|
||||||
|
member: server.member!,
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
children: "Edit Identity",
|
||||||
|
palette: "primary",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!isOwner) {
|
||||||
|
actions.push({
|
||||||
|
onClick: () => {
|
||||||
|
modalController.push({
|
||||||
|
type: "leave_server",
|
||||||
|
target: server,
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
children: "Leave Server",
|
||||||
|
palette: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
actions.push({
|
||||||
|
onClick: () => {
|
||||||
|
modalController.push({
|
||||||
|
type: "report",
|
||||||
|
target: server,
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
children: <Text id="app.special.modals.actions.report" />,
|
||||||
|
palette: "error",
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -26,41 +70,7 @@ export default function ServerInfo({
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Row>
|
</Row>
|
||||||
}
|
}
|
||||||
actions={[
|
actions={actions}>
|
||||||
{
|
|
||||||
onClick: () => {
|
|
||||||
modalController.push({
|
|
||||||
type: "server_identity",
|
|
||||||
member: server.member!,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
children: "Edit Identity",
|
|
||||||
palette: "primary",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
onClick: () => {
|
|
||||||
modalController.push({
|
|
||||||
type: "leave_server",
|
|
||||||
target: server,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
children: "Leave Server",
|
|
||||||
palette: "error",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
onClick: () => {
|
|
||||||
modalController.push({
|
|
||||||
type: "report",
|
|
||||||
target: server,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
children: <Text id="app.special.modals.actions.report" />,
|
|
||||||
palette: "error",
|
|
||||||
},
|
|
||||||
]}>
|
|
||||||
<Markdown content={server.description!} />
|
<Markdown content={server.description!} />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -288,11 +288,7 @@ export default function ContextMenus() {
|
||||||
window.open(
|
window.open(
|
||||||
// ! FIXME: do this from revolt.js
|
// ! FIXME: do this from revolt.js
|
||||||
client
|
client
|
||||||
.generateFileURL(data.attachment)
|
.generateFileURL(data.attachment),
|
||||||
?.replace(
|
|
||||||
"attachments",
|
|
||||||
"attachments/download",
|
|
||||||
),
|
|
||||||
isFirefox || window.native ? "_blank" : "_self",
|
isFirefox || window.native ? "_blank" : "_self",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue