Add ServerNoticeButton to UserBulkActionButtons (#41)

This adds the button to send "Server Notices" to many users at once.
This commit is contained in:
Dirk Klimpel
2020-05-06 09:03:33 +02:00
committed by GitHub
parent c41b8ab846
commit 009ce803e2
3 changed files with 73 additions and 1 deletions

View File

@@ -221,6 +221,29 @@ const dataProvider = {
}));
},
createMany: (resource, params) => {
console.log("createMany " + resource);
const homeserver = localStorage.getItem("base_url");
if (!homeserver || !(resource in resourceMap)) return Promise.reject();
const res = resourceMap[resource];
if (!("create" in res)) return Promise.reject();
return Promise.all(
params.ids.map(id => {
params.data.id = id;
const cre = res["create"](params.data);
const endpoint_url = homeserver + cre.endpoint;
return jsonClient(endpoint_url, {
method: cre.method,
body: JSON.stringify(cre.body, filterNullValues),
});
})
).then(responses => ({
data: responses.map(({ json }) => json),
}));
},
delete: (resource, params) => {
console.log("delete " + resource);
const homeserver = localStorage.getItem("base_url");