connector: set IsSuperGroup on dialog sync
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -124,10 +124,7 @@ func (t *TelegramClient) getGroupChatInfo(fullChat *tg.MessagesChatFull, chatID
|
||||
},
|
||||
CanBackfill: true,
|
||||
ExtraUpdates: func(ctx context.Context, p *bridgev2.Portal) bool {
|
||||
meta := p.Metadata.(*PortalMetadata)
|
||||
changed := meta.IsSuperGroup != isMegagroup
|
||||
meta.IsSuperGroup = isMegagroup
|
||||
return changed
|
||||
return p.Metadata.(*PortalMetadata).SetIsSuperGroup(isMegagroup)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@ type PortalMetadata struct {
|
||||
MessagesTTL int `json:"messages_ttl,omitempty"`
|
||||
}
|
||||
|
||||
func (pm *PortalMetadata) SetIsSuperGroup(isSupergroup bool) (changed bool) {
|
||||
changed = pm.IsSuperGroup != isSupergroup
|
||||
pm.IsSuperGroup = isSupergroup
|
||||
return changed
|
||||
}
|
||||
|
||||
type MessageMetadata struct {
|
||||
ContentHash []byte `json:"content_hash,omitempty"`
|
||||
ContentURI id.ContentURIString `json:"content_uri,omitempty"`
|
||||
|
||||
@@ -172,6 +172,9 @@ func (t *TelegramClient) handleDialogs(ctx context.Context, dialogs tg.ModifiedM
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtraUpdates: func(ctx context.Context, p *bridgev2.Portal) bool {
|
||||
return p.Metadata.(*PortalMetadata).SetIsSuperGroup(channel.(*tg.Channel).GetMegagroup())
|
||||
},
|
||||
}
|
||||
if !portal.Metadata.(*PortalMetadata).IsSuperGroup {
|
||||
// Add the channel user
|
||||
|
||||
Reference in New Issue
Block a user