mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: check that avatar mxc is set before ignoring update
Some checks failed
Some checks failed
This commit is contained in:
parent
7a791e908c
commit
90e3427ac5
2 changed files with 4 additions and 4 deletions
|
|
@ -158,7 +158,7 @@ func (ghost *Ghost) UpdateName(ctx context.Context, name string) bool {
|
|||
}
|
||||
|
||||
func (ghost *Ghost) UpdateAvatar(ctx context.Context, avatar *Avatar) bool {
|
||||
if ghost.AvatarID == avatar.ID && ghost.AvatarSet {
|
||||
if ghost.AvatarID == avatar.ID && (avatar.Remove || ghost.AvatarMXC != "") && ghost.AvatarSet {
|
||||
return false
|
||||
}
|
||||
ghost.AvatarID = avatar.ID
|
||||
|
|
@ -168,7 +168,7 @@ func (ghost *Ghost) UpdateAvatar(ctx context.Context, avatar *Avatar) bool {
|
|||
ghost.AvatarSet = false
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to reupload avatar")
|
||||
return true
|
||||
} else if newHash == ghost.AvatarHash && ghost.AvatarSet {
|
||||
} else if newHash == ghost.AvatarHash && ghost.AvatarMXC != "" && ghost.AvatarSet {
|
||||
return true
|
||||
}
|
||||
ghost.AvatarHash = newHash
|
||||
|
|
|
|||
|
|
@ -3533,7 +3533,7 @@ func (portal *Portal) updateTopic(ctx context.Context, topic string, sender Matr
|
|||
}
|
||||
|
||||
func (portal *Portal) updateAvatar(ctx context.Context, avatar *Avatar, sender MatrixAPI, ts time.Time) bool {
|
||||
if portal.AvatarID == avatar.ID && (portal.AvatarSet || portal.MXID == "") {
|
||||
if portal.AvatarID == avatar.ID && (avatar.Remove || portal.AvatarMXC != "") && (portal.AvatarSet || portal.MXID == "") {
|
||||
return false
|
||||
}
|
||||
portal.AvatarID = avatar.ID
|
||||
|
|
@ -3549,7 +3549,7 @@ func (portal *Portal) updateAvatar(ctx context.Context, avatar *Avatar, sender M
|
|||
portal.AvatarSet = false
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to reupload room avatar")
|
||||
return true
|
||||
} else if newHash == portal.AvatarHash && portal.AvatarSet {
|
||||
} else if newHash == portal.AvatarHash && portal.AvatarMXC != "" && portal.AvatarSet {
|
||||
return true
|
||||
}
|
||||
portal.AvatarMXC = newMXC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue