Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 changelog.d/19677.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a ["Listing quarantined media changes" Admin API](https://element-hq.github.io/synapse/latest/admin_api/media_admin_api.html#listing-quarantined-media-changes) for retrieving a paginated record of when media became (un)quarantined.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches the changelog from #19558 so they merge

👍

2 changes: 1 addition & 1 deletion synapse/rest/admin/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ async def on_GET(self, request: SynapseRequest) -> tuple[int, JsonDict]:

from_id = parse_integer(request, "from", default=0)
limit = 100 # arbitrary; not enough to cause problems (hopefully)
to_id = await self.store.get_current_quarantined_media_stream_id()
Comment thread
turt2live marked this conversation as resolved.
to_id = await self.store.get_max_quarantined_media_stream_id()

if to_id < from_id:
Comment thread
turt2live marked this conversation as resolved.
Outdated
# The caller is trying to get future data, which isn't possible.
Comment thread
turt2live marked this conversation as resolved.
Outdated
Expand Down
8 changes: 4 additions & 4 deletions synapse/storage/databases/main/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,13 +1302,13 @@ def _get_media_ids_by_user_txn(

return local_media_ids

async def get_current_quarantined_media_stream_id(self) -> int:
"""Gets the position of the quarantined media changes stream.
async def get_max_quarantined_media_stream_id(self) -> int:
Comment thread
turt2live marked this conversation as resolved.
Outdated
"""Gets the maximum position of the quarantined media changes stream.
Comment thread
turt2live marked this conversation as resolved.
Outdated

Returns:
int - the current stream ID
int - the maximum stream ID
"""
return self._quarantined_media_changes_id_gen.get_current_token()
return self._quarantined_media_changes_id_gen.get_max_allocated_token()

async def wait_for_quarantined_media_stream_id(self, target_id: int) -> bool:
"""Waits until the quarantined media changes stream reaches the given stream ID.
Expand Down
Loading