Add a new tab to user page with room memberships (#73)
The admin API for user's room memberships is new in synapse v1.21.0. Co-authored-by: Michael Albert <37796947+awesome-michael@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									f2a1275673
								
							
						
					
					
						commit
						706114a382
					
				| @ -52,6 +52,7 @@ const App = () => ( | |||||||
|     <Resource name="connections" /> |     <Resource name="connections" /> | ||||||
|     <Resource name="devices" /> |     <Resource name="devices" /> | ||||||
|     <Resource name="room_members" /> |     <Resource name="room_members" /> | ||||||
|  |     <Resource name="joined_rooms" /> | ||||||
|     <Resource name="pushers" /> |     <Resource name="pushers" /> | ||||||
|     <Resource name="servernotices" /> |     <Resource name="servernotices" /> | ||||||
|   </Admin> |   </Admin> | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ import ContactMailIcon from "@material-ui/icons/ContactMail"; | |||||||
| import DevicesIcon from "@material-ui/icons/Devices"; | import DevicesIcon from "@material-ui/icons/Devices"; | ||||||
| import GetAppIcon from "@material-ui/icons/GetApp"; | import GetAppIcon from "@material-ui/icons/GetApp"; | ||||||
| import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; | import SettingsInputComponentIcon from "@material-ui/icons/SettingsInputComponent"; | ||||||
|  | import ViewListIcon from "@material-ui/icons/ViewList"; | ||||||
| import NotificationsIcon from "@material-ui/icons/Notifications"; | import NotificationsIcon from "@material-ui/icons/Notifications"; | ||||||
| import { | import { | ||||||
|   ArrayInput, |   ArrayInput, | ||||||
| @ -405,6 +406,38 @@ export const UserEdit = props => { | |||||||
|           </ReferenceField> |           </ReferenceField> | ||||||
|         </FormTab> |         </FormTab> | ||||||
| 
 | 
 | ||||||
|  |         <FormTab | ||||||
|  |           label={translate("resources.rooms.name", { smart_count: 2 })} | ||||||
|  |           icon={<ViewListIcon />} | ||||||
|  |           path="rooms" | ||||||
|  |         > | ||||||
|  |           <ReferenceManyField | ||||||
|  |             reference="joined_rooms" | ||||||
|  |             target="user_id" | ||||||
|  |             addLabel={false} | ||||||
|  |           > | ||||||
|  |             <Datagrid | ||||||
|  |               style={{ width: "100%" }} | ||||||
|  |               rowClick={(id, basePath, record) => "/rooms/" + id + "/show"} | ||||||
|  |             > | ||||||
|  |               <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> | ||||||
|  |             </Datagrid> | ||||||
|  |           </ReferenceManyField> | ||||||
|  |         </FormTab> | ||||||
|  | 
 | ||||||
|         <FormTab |         <FormTab | ||||||
|           label={translate("resources.pushers.name", { smart_count: 2 })} |           label={translate("resources.pushers.name", { smart_count: 2 })} | ||||||
|           icon={<NotificationsIcon />} |           icon={<NotificationsIcon />} | ||||||
|  | |||||||
| @ -130,6 +130,18 @@ const resourceMap = { | |||||||
|       return json.total; |       return json.total; | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|  |   joined_rooms: { | ||||||
|  |     map: jr => ({ | ||||||
|  |       id: jr, | ||||||
|  |     }), | ||||||
|  |     reference: id => ({ | ||||||
|  |       endpoint: `/_synapse/admin/v1/users/${id}/joined_rooms`, | ||||||
|  |     }), | ||||||
|  |     data: "joined_rooms", | ||||||
|  |     total: json => { | ||||||
|  |       return json.total; | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|   servernotices: { |   servernotices: { | ||||||
|     map: n => ({ id: n.event_id }), |     map: n => ({ id: n.event_id }), | ||||||
|     create: data => ({ |     create: data => ({ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dirk Klimpel
						Dirk Klimpel