Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rooms' avatars #158

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ The following changes are already implemented:
* 🔍 [Allow providing login form details via GET params](https://github.com/etkecc/synapse-admin/pull/140)
* 🎨 [Add preferred theme colors to login page and footer](https://github.com/etkecc/synapse-admin/pull/155)
* 🔰 [Add "Assign Admin" button to the rooms](https://github.com/etkecc/synapse-admin/pull/156)
* 🖼️ [Add rooms' avatars](https://github.com/etkecc/synapse-admin/pull/158)

_the list will be updated as new changes are added_

Expand Down
9 changes: 6 additions & 3 deletions src/resources/rooms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const RoomShow = (props: ShowProps) => {
<Tab label="synapseadmin.rooms.tabs.members" icon={<UserIcon />} path="members">
<MakeAdminBtn />
<ReferenceManyField reference="room_members" target="room_id" label={false}>
<Datagrid style={{ width: "100%" }} rowClick={id => "/users/" + id} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} rowClick={id => "/users/" + id} bulkActionButtons={false}>
<RaTextField source="id" sortable={false} label="resources.users.fields.id" />
<ReferenceField
label="resources.users.fields.displayname"
Expand Down Expand Up @@ -284,7 +284,7 @@ export const RoomShow = (props: ShowProps) => {

<Tab label={translate("resources.room_state.name", { smart_count: 2 })} icon={<EventIcon />} path="state">
<ReferenceManyField reference="room_state" target="room_id" label={false}>
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
<RaTextField source="type" sortable={false} />
<DateField source="origin_server_ts" showTime options={DATE_FORMAT} sortable={false} />
<FunctionField source="content" sortable={false} render={record => `${JSON.stringify(record.content, null, 2)}`} />
Expand All @@ -305,7 +305,7 @@ export const RoomShow = (props: ShowProps) => {
{translate("resources.rooms.helper.forward_extremities")}
</Box>
<ReferenceManyField reference="forward_extremities" target="room_id" label={false}>
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
<RaTextField source="id" sortable={false} />
<DateField source="received_ts" showTime options={DATE_FORMAT} sortable={false} />
<NumberField source="depth" sortable={false} />
Expand Down Expand Up @@ -358,6 +358,9 @@ export const RoomList = (props: ListProps) => {
bulkActionButtons={<RoomBulkActionButtons />}
omit={["joined_local_members", "state_events", "version", "federatable"]}
>
<ReferenceField reference="rooms" source="id" label={false} link={false} sortable={false}>
<AvatarField source="avatar" sx={{ height: "40px", width: "40px" }} />
</ReferenceField>
<BooleanField
source="is_encrypted"
sortBy="encryption"
Expand Down
34 changes: 17 additions & 17 deletions src/resources/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export const UserEdit = (props: EditProps) => {

<FormTab label={translate("resources.devices.name", { smart_count: 2 })} icon={<DevicesIcon />} path="devices">
<ReferenceManyField reference="devices" target="user_id" label={false}>
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
<TextField source="device_id" sortable={false} />
<TextField source="display_name" sortable={false} />
<TextField source="last_seen_ip" sortable={false} />
Expand All @@ -477,7 +477,7 @@ export const UserEdit = (props: EditProps) => {
<FormTab label="resources.connections.name" icon={<SettingsInputComponentIcon />} path="connections">
<ReferenceField reference="connections" source="id" label={false} link={false}>
<ArrayField source="devices[].sessions[0].connections" label="resources.connections.name">
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
<TextField source="ip" sortable={false} />
<DateField source="last_seen" showTime options={DATE_FORMAT} sortable={false} />
<TextField source="user_agent" sortable={false} style={{ width: "100%" }} />
Expand All @@ -499,7 +499,7 @@ export const UserEdit = (props: EditProps) => {
perPage={50}
sort={{ field: "created_ts", order: "DESC" }}
>
<Datagrid style={{ width: "100%" }}>
<Datagrid sx={{ width: "100%" }}>
<MediaIDField source="media_id" />
<DateField source="created_ts" showTime options={DATE_FORMAT} />
<DateField source="last_access_ts" showTime options={DATE_FORMAT} />
Expand All @@ -516,19 +516,19 @@ export const UserEdit = (props: EditProps) => {

<FormTab label={translate("resources.rooms.name", { smart_count: 2 })} icon={<ViewListIcon />} path="rooms">
<ReferenceManyField reference="joined_rooms" target="user_id" label={false}>
<Datagrid style={{ width: "100%" }} rowClick={id => "/rooms/" + id + "/show"} bulkActionButtons={false}>
<TextField source="id" sortable={false} label="resources.rooms.fields.room_id" />
<ReferenceField
label="resources.rooms.fields.name"
source="id"
reference="rooms"
sortable={false}
link=""
>
<TextField source="name" sortable={false} />
</ReferenceField>
<MakeAdminBtn />
</Datagrid>
<Datagrid sx={{ width: "100%" }} rowClick={id => "/rooms/" + id + "/show"} bulkActionButtons={false}>
<ReferenceField reference="rooms" source="id" label={false} link={false} sortable={false}>
<AvatarField source="avatar" sx={{ height: "40px", width: "40px" }} />
</ReferenceField>
<TextField source="id" label="resources.rooms.fields.room_id" sortable={false}/>
<ReferenceField reference="rooms" source="id" label="resources.rooms.fields.name" link={false} sortable={false}>
<TextField source="name" />
</ReferenceField>
<ReferenceField reference="rooms" source="id" label="resources.rooms.fields.joined_members" link={false} sortable={false}>
<TextField source="joined_members" sortable={false} />
</ReferenceField>
<MakeAdminBtn />
</Datagrid>
</ReferenceManyField>
</FormTab>

Expand All @@ -538,7 +538,7 @@ export const UserEdit = (props: EditProps) => {
path="pushers"
>
<ReferenceManyField reference="pushers" target="user_id" label={false}>
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
<TextField source="kind" sortable={false} />
<TextField source="app_display_name" sortable={false} />
<TextField source="app_id" sortable={false} />
Expand Down