capabilities: add ID component to channels

This commit is contained in:
Tulir Asokan
2026-05-04 18:15:26 +03:00
parent 60c6d4471d
commit 9a624a3981

View File

@@ -261,16 +261,6 @@ func (tc *TelegramClient) GetCapabilities(ctx context.Context, portal *bridgev2.
}
portalMetadata := portal.Metadata.(*PortalMetadata)
peerType, _, topicID, _ := ids.ParsePortalID(portal.ID)
if topicID > 0 {
baseID += "+topic"
// TODO do topics have other changes?
delete(feat.State, event.StateRoomAvatar.Type)
delete(feat.State, event.StateBeeperDisappearingTimer.Type)
feat.DisappearingTimer = nil
} else if topicID == ids.TopicIDSpaceRoom {
baseID += "+spaceroom"
feat = &event.RoomFeatures{}
}
switch peerType {
case ids.PeerTypeChat:
feat.ID += "minigroup"
@@ -283,6 +273,7 @@ func (tc *TelegramClient) GetCapabilities(ctx context.Context, portal *bridgev2.
// Minigroups can always be deleted
feat.DeleteChatForEveryone = true
case ids.PeerTypeChannel:
feat.ID += "channel"
feat.MemberActions = map[event.MemberAction]event.CapabilitySupportLevel{
event.MemberActionBan: event.CapLevelFullySupported,
event.MemberActionKick: event.CapLevelFullySupported,
@@ -301,6 +292,16 @@ func (tc *TelegramClient) GetCapabilities(ctx context.Context, portal *bridgev2.
event.StateBeeperDisappearingTimer.Type: {Level: event.CapLevelFullySupported},
}
}
if topicID > 0 {
baseID += "+topic"
// TODO do topics have other changes?
delete(feat.State, event.StateRoomAvatar.Type)
delete(feat.State, event.StateBeeperDisappearingTimer.Type)
feat.DisappearingTimer = nil
} else if topicID == ids.TopicIDSpaceRoom {
baseID += "+spaceroom"
feat = &event.RoomFeatures{}
}
feat.ID = baseID
return feat