mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/status: use _file pattern for avatar instead of splitting url and keys
This commit is contained in:
parent
9f693702b0
commit
febca20dd7
1 changed files with 5 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ import (
|
|||
"go.mau.fi/util/ptr"
|
||||
|
||||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/crypto/attachment"
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
|
||||
|
|
@ -89,8 +89,7 @@ type RemoteProfile struct {
|
|||
Name string `json:"name,omitempty"`
|
||||
Avatar id.ContentURIString `json:"avatar,omitempty"`
|
||||
|
||||
// Only used for backups of local bridge states
|
||||
AvatarKeys *attachment.EncryptedFile `json:"avatar_keys,omitempty"`
|
||||
AvatarFile *event.EncryptedFileInfo `json:"avatar_file,omitempty"`
|
||||
}
|
||||
|
||||
func coalesce[T ~string](a, b T) T {
|
||||
|
|
@ -106,14 +105,14 @@ func (rp *RemoteProfile) Merge(other RemoteProfile) RemoteProfile {
|
|||
other.Username = coalesce(rp.Username, other.Username)
|
||||
other.Name = coalesce(rp.Name, other.Name)
|
||||
other.Avatar = coalesce(rp.Avatar, other.Avatar)
|
||||
if rp.AvatarKeys != nil {
|
||||
other.AvatarKeys = rp.AvatarKeys
|
||||
if rp.AvatarFile != nil {
|
||||
other.AvatarFile = rp.AvatarFile
|
||||
}
|
||||
return other
|
||||
}
|
||||
|
||||
func (rp *RemoteProfile) IsEmpty() bool {
|
||||
return rp == nil || (rp.Phone == "" && rp.Email == "" && rp.Username == "" && rp.Name == "" && rp.Avatar == "")
|
||||
return rp == nil || (rp.Phone == "" && rp.Email == "" && rp.Username == "" && rp.Name == "" && rp.Avatar == "" && rp.AvatarFile == nil)
|
||||
}
|
||||
|
||||
type BridgeState struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue