Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dklimpel committed Feb 14, 2023
1 parent 16e7495 commit 6dfbf5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions synapse/app/admin_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os
import sys
import tempfile
from typing import Dict, List, Optional
from typing import List, Mapping, Optional

from twisted.internet import defer, task

Expand Down Expand Up @@ -223,7 +223,7 @@ def write_connections(self, connections: List[JsonDict]) -> None:
print(json.dumps(connection), file=f)

def write_account_data(
self, file_name: str, account_data: Dict[str, JsonDict]
self, file_name: str, account_data: Mapping[str, JsonDict]
) -> None:
account_data_directory = os.path.join(
self.base_directory, "user_data", "account_data"
Expand Down
9 changes: 5 additions & 4 deletions synapse/handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import abc
import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Set

from synapse.api.constants import Direction, Membership
from synapse.events import EventBase
Expand Down Expand Up @@ -264,7 +264,8 @@ async def export_user_data(self, user_id: str, writer: "ExfiltrationWriter") ->
)

# Get all account data the user has global and in rooms
global_data, by_room_data = await self._store.get_account_data_for_user(user_id)
global_data = await self._store.get_global_account_data_for_user(user_id)
by_room_data = await self._store.get_room_account_data_for_user(user_id)
writer.write_account_data("global", global_data)
for room_id in by_room_data:
writer.write_account_data(room_id, by_room_data[room_id])
Expand Down Expand Up @@ -348,13 +349,13 @@ def write_connections(self, connections: List[JsonDict]) -> None:

@abc.abstractmethod
def write_account_data(
self, file_name: str, account_data: Dict[str, JsonDict]
self, file_name: str, account_data: Mapping[str, JsonDict]
) -> None:
"""Write the account data of a user.
Args:
file_name: file name to write data
account_data: dict of global or room account_data
account_data: mapping of global or room account_data
"""
raise NotImplementedError()

Expand Down

0 comments on commit 6dfbf5a

Please sign in to comment.