client: add shortcut field for user login metadata

This commit is contained in:
Tulir Asokan
2025-12-07 20:01:11 +02:00
parent 6729a9ad09
commit abb4671a16
5 changed files with 24 additions and 22 deletions
+3 -3
View File
@@ -1172,14 +1172,14 @@ func (t *TelegramClient) onNotifySettings(ctx context.Context, e tg.Entities, up
func (t *TelegramClient) onPinnedDialogs(ctx context.Context, e tg.Entities, msg *tg.UpdatePinnedDialogs) error {
needsUnpinning := map[networkid.PortalKey]struct{}{}
for _, portalID := range t.userLogin.Metadata.(*UserLoginMetadata).PinnedDialogs {
for _, portalID := range t.metadata.PinnedDialogs {
pt, id, _, err := ids.ParsePortalID(portalID)
if err != nil {
return err
}
needsUnpinning[t.makePortalKeyFromID(pt, id, 0)] = struct{}{}
}
t.userLogin.Metadata.(*UserLoginMetadata).PinnedDialogs = nil
t.metadata.PinnedDialogs = nil
for _, d := range msg.Order {
dialog, ok := d.(*tg.DialogPeer)
@@ -1188,7 +1188,7 @@ func (t *TelegramClient) onPinnedDialogs(ctx context.Context, e tg.Entities, msg
}
portalKey := t.makePortalKeyFromPeer(dialog.Peer, 0)
delete(needsUnpinning, portalKey)
t.userLogin.Metadata.(*UserLoginMetadata).PinnedDialogs = append(t.userLogin.Metadata.(*UserLoginMetadata).PinnedDialogs, portalKey.ID)
t.metadata.PinnedDialogs = append(t.metadata.PinnedDialogs, portalKey.ID)
res := t.main.Bridge.QueueRemoteEvent(t.userLogin, &simplevent.ChatInfoChange{
ChatInfoChange: &bridgev2.ChatInfoChange{