summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2021-05-26 12:19:47 +0200
committerGitHub <noreply@github.com>2021-05-26 11:19:47 +0100
commit65e6c64d8317d3a10527a7e422753281f3e9ec81 (patch)
treec2c95b4051d40ee29d2b02af3946f630c547862d /synapse/storage/databases
parentUpdate CAPTCHA documentation to mention turning off verify origin feature (#1... (diff)
downloadsynapse-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/databases')
-rw-r--r--synapse/storage/databases/main/media_repository.py7
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",
         )