Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use group change #283

Merged
merged 4 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
50 changes: 38 additions & 12 deletions mausignald/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ class Group(SerializableAttrs):
avatar_id: int = field(default=0, json="avatarId")


@dataclass(kw_only=True)
class GroupV2ID(SerializableAttrs):
id: GroupID
revision: Optional[int] = None
removed: Optional[bool] = False


class AccessControlMode(SerializableEnum):
UNKNOWN = "UNKNOWN"
ANY = "ANY"
Expand All @@ -197,9 +190,9 @@ class AnnouncementsMode(SerializableEnum):

@dataclass
class GroupAccessControl(SerializableAttrs):
attributes: Optional[AccessControlMode] = AccessControlMode.UNKNOWN
link: Optional[AccessControlMode] = AccessControlMode.UNKNOWN
members: Optional[AccessControlMode] = AccessControlMode.UNKNOWN
attributes: Optional[AccessControlMode] = None
link: Optional[AccessControlMode] = None
members: Optional[AccessControlMode] = None


class GroupMemberRole(SerializableEnum):
Expand All @@ -222,9 +215,42 @@ class BannedGroupMember(SerializableAttrs):
timestamp: int


@dataclass
class GroupChange(SerializableAttrs):
revision: int
editor: Address
delete_members: Optional[List[Address]] = None
delete_pending_members: Optional[List[Address]] = None
delete_requesting_members: Optional[List[Address]] = None
modified_profile_keys: Optional[List[GroupMember]] = None
modify_member_roles: Optional[List[GroupMember]] = None
new_access_control: Optional[GroupAccessControl] = None
new_avatar: bool = False
new_banned_members: Optional[List[GroupMember]] = None
new_description: Optional[str] = None
new_invite_link_password: bool = False
new_is_announcement_group: Optional[AnnouncementsMode] = None
new_members: Optional[List[GroupMember]] = None
new_pending_members: Optional[List[GroupMember]] = None
new_requesting_members: Optional[List[GroupMember]] = None
new_timer: Optional[int] = None
new_title: Optional[str] = None
new_unbanned_members: Optional[List[GroupMember]] = None
promote_pending_members: Optional[List[GroupMember]] = None
promote_requesting_members: Optional[List[GroupMember]] = None


@dataclass(kw_only=True)
class GroupV2ID(SerializableAttrs):
id: GroupID
revision: Optional[int] = None
removed: Optional[bool] = False
group_change: Optional[GroupChange] = None


@dataclass(kw_only=True)
class GroupV2(GroupV2ID, SerializableAttrs):
title: str
title: str = None
description: Optional[str] = None
avatar: Optional[str] = None
timer: Optional[int] = None
Expand All @@ -233,7 +259,7 @@ class GroupV2(GroupV2ID, SerializableAttrs):
access_control: GroupAccessControl = field(
factory=lambda: GroupAccessControl(), json="accessControl"
)
members: List[Address]
members: List[Address] = None
member_detail: List[GroupMember] = field(factory=lambda: [], json="memberDetail")
pending_members: List[Address] = field(factory=lambda: [], json="pendingMembers")
pending_member_detail: List[GroupMember] = field(
Expand Down
1 change: 1 addition & 0 deletions mautrix_signal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:
copy("bridge.autocreate_group_portal")
copy("bridge.autocreate_contact_portal")
copy("bridge.sync_with_custom_puppets")
copy("bridge.public_portals")
copy("bridge.sync_direct_chat_list")
copy("bridge.double_puppet_server_map")
copy("bridge.double_puppet_allow_discovery")
Expand Down
3 changes: 3 additions & 0 deletions mautrix_signal/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ bridge:
autocreate_group_portal: true
# Whether or not to create portals for all contacts on login/connect.
autocreate_contact_portal: false
# Whether or not to make portals of Signal groups in which joining via invite link does
# not need to be approved by an administrator publicly joinable on Matrix.
public_portals: false
# Whether or not to use /sync to get read receipts and typing notifications
# when double puppeting is enabled
sync_with_custom_puppets: true
Expand Down
Loading