yarn fix
This commit is contained in:
parent
b51882a5d8
commit
f5b56ee42f
@ -46,7 +46,7 @@ import {
|
|||||||
TopToolbar,
|
TopToolbar,
|
||||||
sanitizeListRestProps,
|
sanitizeListRestProps,
|
||||||
NumberField,
|
NumberField,
|
||||||
ImageField
|
ImageField,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
||||||
@ -451,9 +451,10 @@ export const UserEdit = props => {
|
|||||||
perPage={50}
|
perPage={50}
|
||||||
sort={{ field: "created_ts", order: "DESC" }}
|
sort={{ field: "created_ts", order: "DESC" }}
|
||||||
>
|
>
|
||||||
<Datagrid style={{ width: "100%" }}
|
<Datagrid
|
||||||
expand={ <ImageField source="url" /> }
|
style={{ width: "100%" }}
|
||||||
isRowExpandable={row => row.is_image }
|
expand={<ImageField source="url" />}
|
||||||
|
isRowExpandable={row => row.is_image}
|
||||||
>
|
>
|
||||||
<DateField source="created_ts" showTime options={date_format} />
|
<DateField source="created_ts" showTime options={date_format} />
|
||||||
<DateField
|
<DateField
|
||||||
|
@ -27,7 +27,7 @@ const mxcUrlToHttp = mxcUrl => {
|
|||||||
|
|
||||||
async function isImage(url) {
|
async function isImage(url) {
|
||||||
const resp = await fetch(url, {
|
const resp = await fetch(url, {
|
||||||
method: "HEAD"
|
method: "HEAD",
|
||||||
});
|
});
|
||||||
|
|
||||||
const type = resp.headers.get("Content-Type");
|
const type = resp.headers.get("Content-Type");
|
||||||
@ -170,8 +170,18 @@ const resourceMap = {
|
|||||||
map: async um => ({
|
map: async um => ({
|
||||||
...um,
|
...um,
|
||||||
id: um.media_id,
|
id: um.media_id,
|
||||||
url: `${localStorage.getItem("base_url")}/_matrix/media/v3/download/${localStorage.getItem("home_server")}/${um.media_id}`,
|
url: `${localStorage.getItem(
|
||||||
is_image: await isImage(`${localStorage.getItem("base_url")}/_matrix/media/v3/download/${localStorage.getItem("home_server")}/${um.media_id}`)
|
"base_url"
|
||||||
|
)}/_matrix/media/v3/download/${localStorage.getItem("home_server")}/${
|
||||||
|
um.media_id
|
||||||
|
}`,
|
||||||
|
is_image: await isImage(
|
||||||
|
`${localStorage.getItem(
|
||||||
|
"base_url"
|
||||||
|
)}/_matrix/media/v3/download/${localStorage.getItem("home_server")}/${
|
||||||
|
um.media_id
|
||||||
|
}`
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
reference: id => ({
|
reference: id => ({
|
||||||
endpoint: `/_synapse/admin/v1/users/${id}/media`,
|
endpoint: `/_synapse/admin/v1/users/${id}/media`,
|
||||||
@ -416,7 +426,7 @@ const dataProvider = {
|
|||||||
return {
|
return {
|
||||||
data: data,
|
data: data,
|
||||||
total: res.total(json, from, perPage),
|
total: res.total(json, from, perPage),
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user