Add confirmation when deleting rooms

Change-Id: I5dce8ebfb7cab988e0e6664c704c04b44a4d2f92
This commit is contained in:
Michael Albert 2020-10-07 21:42:19 +02:00
parent 26b8cea6a5
commit 4324ebfdb8
3 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,7 @@ import React, { Fragment } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
BooleanField, BooleanField,
BulkDeleteWithConfirmButton,
Datagrid, Datagrid,
Filter, Filter,
List, List,
@ -181,6 +182,13 @@ export const RoomShow = props => {
</Show> </Show>
); );
}; };
const RoomBulkActionButtons = props => (
<Fragment>
<BulkDeleteWithConfirmButton {...props} />
</Fragment>
);
const RoomFilter = ({ ...props }) => { const RoomFilter = ({ ...props }) => {
const translate = useTranslate(); const translate = useTranslate();
return ( return (
@ -220,6 +228,7 @@ const FilterableRoomList = ({ ...props }) => {
const stateEventsFilter = filter && filter.state_events ? true : false; const stateEventsFilter = filter && filter.state_events ? true : false;
const versionFilter = filter && filter.version ? true : false; const versionFilter = filter && filter.version ? true : false;
const federateableFilter = filter && filter.federatable ? true : false; const federateableFilter = filter && filter.federatable ? true : false;
const translate = useTranslate();
return ( return (
<List <List
@ -227,6 +236,7 @@ const FilterableRoomList = ({ ...props }) => {
pagination={<RoomPagination />} pagination={<RoomPagination />}
sort={{ field: "name", order: "ASC" }} sort={{ field: "name", order: "ASC" }}
filters={<RoomFilter />} filters={<RoomFilter />}
bulkActionButtons={<RoomBulkActionButtons confirmTitle={translate("synapseadmin.rooms.delete.title")} confirmContent={translate("synapseadmin.rooms.delete.message")}/>}
> >
<Datagrid rowClick="show"> <Datagrid rowClick="show">
<EncryptionField <EncryptionField

View file

@ -23,6 +23,10 @@ export default {
detail: "Details", detail: "Details",
permission: "Berechtigungen", permission: "Berechtigungen",
}, },
delete: {
title: "Raum löschen",
message: "Sind Sie sicher dass Sie den Raum löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden. Alle Nachrichten und Medien, die der Raum beinhaltet werden vom Server gelöscht!",
},
}, },
}, },
resources: { resources: {

View file

@ -21,6 +21,10 @@ export default {
detail: "Details", detail: "Details",
permission: "Permissions", permission: "Permissions",
}, },
delete: {
title: "Delete room",
message: "Are you sure you want to delete the room? This cannot be undone. All messages and shared media in the room will be deleted from the server!",
},
}, },
}, },
resources: { resources: {