mirror of
https://github.com/mautrix/signal.git
synced 2025-03-14 14:15:36 +00:00
chatinfo: only clear avatar after fetching profile with no avatar
This commit is contained in:
parent
8cdc01f21d
commit
030c83c197
2 changed files with 10 additions and 6 deletions
|
@ -102,6 +102,11 @@ func (s *SignalClient) contactToUserInfo(contact *types.Recipient) *bridgev2.Use
|
|||
return contact.ContactAvatar.Image, nil
|
||||
},
|
||||
}
|
||||
} else if contact.Profile.AvatarPath == "clear" {
|
||||
ui.Avatar = &bridgev2.Avatar{
|
||||
ID: "",
|
||||
Remove: true,
|
||||
}
|
||||
} else if contact.Profile.AvatarPath != "" {
|
||||
ui.Avatar = &bridgev2.Avatar{
|
||||
ID: makeAvatarPathID(contact.Profile.AvatarPath),
|
||||
|
@ -109,11 +114,6 @@ func (s *SignalClient) contactToUserInfo(contact *types.Recipient) *bridgev2.Use
|
|||
return s.Client.DownloadUserAvatar(ctx, contact.Profile.AvatarPath, contact.Profile.Key)
|
||||
},
|
||||
}
|
||||
} else {
|
||||
ui.Avatar = &bridgev2.Avatar{
|
||||
ID: "",
|
||||
Remove: true,
|
||||
}
|
||||
}
|
||||
return ui
|
||||
}
|
||||
|
|
|
@ -243,7 +243,11 @@ func (cli *Client) fetchProfileWithRequestAndKey(ctx context.Context, signalID u
|
|||
}
|
||||
}
|
||||
// TODO store other metadata fields?
|
||||
profile.AvatarPath = profileResponse.Avatar
|
||||
if profileResponse.Avatar == "" {
|
||||
profile.AvatarPath = "clear"
|
||||
} else {
|
||||
profile.AvatarPath = profileResponse.Avatar
|
||||
}
|
||||
profile.Credential = profileResponse.Credential
|
||||
profile.Key = *profileKey
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue