Compare commits

..

No commits in common. "f9c2fcec561c8a9d9f9ae0f98dc9c77165f1a9f4" and "ac2beaf549feb41deabf5aaed8d0accb58c6d275" have entirely different histories.

4 changed files with 44 additions and 51 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit 4ec2f99855825743f65eabd715ec77f61c28c5d8 Subproject commit 07f4343342c3d06a2b540db3bb14f598d745c09a

View file

@ -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; const download_url = url?.replace("attachments", "attachments/download");
const filesize = determineFileSize(size); const filesize = determineFileSize(size);
@ -49,11 +49,10 @@ 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} />

View file

@ -5,7 +5,6 @@ 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";
@ -14,49 +13,6 @@ 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}
@ -70,7 +26,41 @@ 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>
); );

View file

@ -288,7 +288,11 @@ 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",
); );
} }