|
40 | 40 | ) |
41 | 41 |
|
42 | 42 | import attr |
43 | | -from typing_extensions import TypedDict |
44 | 43 |
|
45 | 44 | import synapse.events.snapshot |
46 | 45 | from synapse.api.constants import ( |
|
81 | 80 | RoomAlias, |
82 | 81 | RoomID, |
83 | 82 | RoomStreamToken, |
| 83 | + ShutdownRoomParams, |
| 84 | + ShutdownRoomResponse, |
84 | 85 | StateMap, |
85 | 86 | StrCollection, |
86 | 87 | StreamKeyType, |
@@ -1780,63 +1781,6 @@ def get_current_key_for_room(self, room_id: str) -> Awaitable[RoomStreamToken]: |
1780 | 1781 | return self.store.get_current_room_stream_token_for_room_id(room_id) |
1781 | 1782 |
|
1782 | 1783 |
|
1783 | | -class ShutdownRoomParams(TypedDict): |
1784 | | - """ |
1785 | | - Attributes: |
1786 | | - requester_user_id: |
1787 | | - User who requested the action. Will be recorded as putting the room on the |
1788 | | - blocking list. |
1789 | | - new_room_user_id: |
1790 | | - If set, a new room will be created with this user ID |
1791 | | - as the creator and admin, and all users in the old room will be |
1792 | | - moved into that room. If not set, no new room will be created |
1793 | | - and the users will just be removed from the old room. |
1794 | | - new_room_name: |
1795 | | - A string representing the name of the room that new users will |
1796 | | - be invited to. Defaults to `Content Violation Notification` |
1797 | | - message: |
1798 | | - A string containing the first message that will be sent as |
1799 | | - `new_room_user_id` in the new room. Ideally this will clearly |
1800 | | - convey why the original room was shut down. |
1801 | | - Defaults to `Sharing illegal content on this server is not |
1802 | | - permitted and rooms in violation will be blocked.` |
1803 | | - block: |
1804 | | - If set to `true`, this room will be added to a blocking list, |
1805 | | - preventing future attempts to join the room. Defaults to `false`. |
1806 | | - purge: |
1807 | | - If set to `true`, purge the given room from the database. |
1808 | | - force_purge: |
1809 | | - If set to `true`, the room will be purged from database |
1810 | | - even if there are still users joined to the room. |
1811 | | - """ |
1812 | | - |
1813 | | - requester_user_id: Optional[str] |
1814 | | - new_room_user_id: Optional[str] |
1815 | | - new_room_name: Optional[str] |
1816 | | - message: Optional[str] |
1817 | | - block: bool |
1818 | | - purge: bool |
1819 | | - force_purge: bool |
1820 | | - |
1821 | | - |
1822 | | -class ShutdownRoomResponse(TypedDict): |
1823 | | - """ |
1824 | | - Attributes: |
1825 | | - kicked_users: An array of users (`user_id`) that were kicked. |
1826 | | - failed_to_kick_users: |
1827 | | - An array of users (`user_id`) that that were not kicked. |
1828 | | - local_aliases: |
1829 | | - An array of strings representing the local aliases that were |
1830 | | - migrated from the old room to the new. |
1831 | | - new_room_id: A string representing the room ID of the new room. |
1832 | | - """ |
1833 | | - |
1834 | | - kicked_users: List[str] |
1835 | | - failed_to_kick_users: List[str] |
1836 | | - local_aliases: List[str] |
1837 | | - new_room_id: Optional[str] |
1838 | | - |
1839 | | - |
1840 | 1784 | class RoomShutdownHandler: |
1841 | 1785 | DEFAULT_MESSAGE = ( |
1842 | 1786 | "Sharing illegal content on this server is not permitted and rooms in" |
|
0 commit comments