diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2021-05-26 12:19:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 11:19:47 +0100 |
commit | 65e6c64d8317d3a10527a7e422753281f3e9ec81 (patch) | |
tree | c2c95b4051d40ee29d2b02af3946f630c547862d /synapse/storage | |
parent | Update CAPTCHA documentation to mention turning off verify origin feature (#1... (diff) | |
download | synapse-65e6c64d8317d3a10527a7e422753281f3e9ec81.tar.xz |
Add an admin API for unprotecting local media from quarantine (#10040)
Signed-off-by: Dirk Klimpel dirk@klimpel.org
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/databases/main/media_repository.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/media_repository.py b/synapse/storage/databases/main/media_repository.py index c584868188..2fa945d171 100644 --- a/synapse/storage/databases/main/media_repository.py +++ b/synapse/storage/databases/main/media_repository.py @@ -143,6 +143,7 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore): "created_ts", "quarantined_by", "url_cache", + "safe_from_quarantine", ), allow_none=True, desc="get_local_media", @@ -296,12 +297,12 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore): desc="store_local_media", ) - async def mark_local_media_as_safe(self, media_id: str) -> None: - """Mark a local media as safe from quarantining.""" + async def mark_local_media_as_safe(self, media_id: str, safe: bool = True) -> None: + """Mark a local media as safe or unsafe from quarantining.""" await self.db_pool.simple_update_one( table="local_media_repository", keyvalues={"media_id": media_id}, - updatevalues={"safe_from_quarantine": True}, + updatevalues={"safe_from_quarantine": safe}, desc="mark_local_media_as_safe", ) |