Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

How to delete local media for a specific user ? #9565

Closed
githuberyt opened this issue Mar 9, 2021 · 2 comments · Fixed by #10558
Closed

How to delete local media for a specific user ? #9565

githuberyt opened this issue Mar 9, 2021 · 2 comments · Fixed by #10558
Labels
T-Other Questions, user support, anything else.

Comments

@githuberyt
Copy link

githuberyt commented Mar 9, 2021

How to delete local media for a specific user ?

@githuberyt githuberyt changed the title How to delete local media for specific user ? How to delete local media for a specific user ? Mar 9, 2021
@anoadragon453
Copy link
Member

Currently you can only use the admin API to quarantine media by uploader user ID: https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/media_admin_api.md#quarantining-all-media-of-a-user. This prevents your server from serving the media to anyone anymore, and is typically used to combat abusive material (while allowing you to inspect it before blasting it away).

There isn't currently an equivalent endpoint for deleting media by user ID, however you can get all IDs of media uploaded by a given user with the following database query:

SELECT * FROM local_media_repository WHERE user_id = '@alice:example.com';

And then use the Delete Local Media Admin API to remove each one.

@anoadragon453 anoadragon453 added the T-Other Questions, user support, anything else. label Mar 9, 2021
@clokep
Copy link
Contributor

clokep commented Mar 9, 2021

however you can get all IDs of media uploaded by a given user with the following database query:

SELECT * FROM local_media_repository WHERE user_id = '@alice:example.com';

There's an admin API for this: https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/user_admin_api.rst#list-media-of-a-user

anoadragon453 added a commit that referenced this issue Mar 9, 2021
)

Earlier [I was convinced](#9565) that we didn't have an Admin API for listing media uploaded by a user. Foolishly I was looking under the Media Admin API documentation, instead of the User Admin API documentation.

I thought it'd be helpful to link to the latter so others don't hit the same dead end :)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Other Questions, user support, anything else.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants