diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2023-10-31 13:13:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 13:13:28 -0400 |
commit | cfb6d38c47711b8dfaf0125353aec88d16708b97 (patch) | |
tree | 5376fba887e841c9574b5ee444719560e5c47135 /synapse/rest/admin/media.py | |
parent | Merge branch 'release-v1.96' into develop (diff) | |
download | synapse-cfb6d38c47711b8dfaf0125353aec88d16708b97.tar.xz |
Remove remaining usage of cursor_to_dict. (#16564)
Diffstat (limited to 'synapse/rest/admin/media.py')
-rw-r--r-- | synapse/rest/admin/media.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/rest/admin/media.py b/synapse/rest/admin/media.py index b7637dff0b..8cf5268854 100644 --- a/synapse/rest/admin/media.py +++ b/synapse/rest/admin/media.py @@ -17,6 +17,8 @@ import logging from http import HTTPStatus from typing import TYPE_CHECKING, Optional, Tuple +import attr + from synapse.api.constants import Direction from synapse.api.errors import Codes, NotFoundError, SynapseError from synapse.http.server import HttpServer @@ -418,7 +420,7 @@ class UserMediaRestServlet(RestServlet): start, limit, user_id, order_by, direction ) - ret = {"media": media, "total": total} + ret = {"media": [attr.asdict(m) for m in media], "total": total} if (start + limit) < total: ret["next_token"] = start + len(media) @@ -477,7 +479,7 @@ class UserMediaRestServlet(RestServlet): ) deleted_media, total = await self.media_repository.delete_local_media_ids( - [row["media_id"] for row in media] + [m.media_id for m in media] ) return HTTPStatus.OK, {"deleted_media": deleted_media, "total": total} |